简体   繁体   English

phpThumb-更改水印大小

[英]phpThumb - change watermark size

I'm using phpThumb in a script to clean my images and add a watermark to them. 我在脚本中使用phpThumb清理图像并在图像中添加水印。 We have images of very different sizes (from 100px width to 800px), so no matter what watermark image I use, it's either going to look too small or too big on the image. 我们有大小不同的图像(从100像素宽度到800像素),所以无论我使用什么水印图像,它在图像上看起来要么太小要么太大。

Do you know of a way to tell phpThumb to resize the watermark? 您知道一种告诉phpThumb调整水印大小的方法吗? Or is there a way to resize the watermark image (depending on size of image being watermarked)? 还是有一种方法可以调整水印图像的大小(取决于要加水印的图像的大小)?

Thanks a lot guys! 非常感谢你们! Ali 阿里

I am facing the same issue. 我正面临着同样的问题。

Maybe you could put some if statements in the phpthumb.config file in the DEFAULT PARAMETER SECTION 也许您可以在默认参数部分的phpthumb.config文件中放置一些if语句

then depending on the height and width parameters you can decide to use different files with varying sizes for the watermark. 然后根据高度和宽度参数,您可以决定对水印使用不同大小的不同文件。

make sure you change $PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE to false 确保将$ PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE更改为false

This is not perfect cause you could not know the source image size to start with. 这不是完美的,因为您不知道开始时的源图像大小。

but it would be a better fit based on the parameters passed to phpthumb. 但是根据传递给phpthumb的参数会更好。

I guess the only other solution would be to use phpthumb as an object but that would require a lot of work. 我猜唯一的解决方案是将phpthumb用作对象,但这需要大量工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM