Himanshu Pandey
Himanshu Pandey

Reputation: 1270

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

Upvotes: 2

Views: 3920

Answers (3)

khanz
khanz

Reputation: 203

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" 

Upvotes: 4

Veerendra
Veerendra

Reputation: 2622

Try replacing ImageCreateFromJPEG($file) with ImageCreateFromPNG($file)

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

Upvotes: 4

Bhavik Shah
Bhavik Shah

Reputation: 2291

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.

Upvotes: 2

Related Questions