[英]PHP thumb resize png image but add black background
Here is the example to avoid black background: 以下是避免黑色背景的示例:
src="/uploads/phpThumb.php?src=images/expressionengine_logo.png&w=100&f=png"
src="/uploads/phpThumb.php?src=images/expressionengine_logo.png&w=100&bg=D4E9F7"
Try replacing ImageCreateFromJPEG ($file) with ImageCreateFromPNG ($file) 尝试用ImageCreateFromPNG ($ file)替换ImageCreateFromJPEG ($ file)
Most probably this is the common error for the black background in the resized pngimage 最有可能这是调整大小的pngimage中黑色背景的常见错误
Well, I am not familiar with PHPThumb
but you can use SimpleImage library with this update. 好吧,我不熟悉PHPThumb
但您可以使用SimpleImage库进行此更新。
I am using it and didnt faced any problems yet. 我正在使用它并没有遇到任何问题。 This library has purposefully updated for the problem you are facing right now. 此库已针对您目前面临的问题进行了有针对性的更新。 Go to the links and try to use it. 转到链接并尝试使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.