简体   繁体   中英

PHP thumb resize png image but add black background

I am using PHPThumb to resize images rumtime. It is working fine but it add black background on PNG image. 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)

Most probably this is the common error for the black background in the resized pngimage

Well, I am not familiar with PHPThumb but you can use SimpleImage library with this update.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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