简体   繁体   English

PHP拇指调整png图像大小但添加黑色背景

[英]PHP thumb resize png image but add black background

I am using PHPThumb to resize images rumtime. 我正在使用PHPThumb来调整图像的朗读时间。 It is working fine but it add black background on PNG image. 它工作正常,但它在PNG图像上添加黑色背景。 How could I resolve this? 我怎么能解决这个问题? my path is 我的道路是

phpThumb/phpThumb.php?src={imagepath}&w=95&h=92

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.

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