JamesHeinrich / phpThumb

phpThumb() - The PHP thumbnail generator
Other
315 stars 98 forks source link

Transparency problem on some server #92

Closed Va1iant closed 6 years ago

Va1iant commented 6 years ago

This problem made me scratch my head so hard. phpthumb works in my localhost but when i ported my application to a remote server the result are different. For the target file I'm using a png image with transparent background that resides within the app directory (so always local in reference to the app). But the result is in my localhost it can correctly show tranparent bg, but in remote the background change to white

here's the link to the image in both local server (works) http://futscore.dev/phpthumb/phpThumb.php?w=100&h=100&q=80&far=1&bg=EEEEEE&f=png&src=..%2Fassets%2Fimg%2Ftrophy.png&hash=e951243953836cd47d42e33e2e999726 remote server (doesn't work) https://futscore.com/phpthumb/phpThumb.php?w=100&h=100&q=80&far=1&bg=EEEEEE&f=png&src=..%2Fassets%2Fimg%2Ftrophy.png&hash=e951243953836cd47d42e33e2e999726

attached is the images in both. I purposely set the image against a blue bg so the tranparency can be observed

image

JamesHeinrich commented 6 years ago

You could take a look at /demo/phpThumb.demo.demo.php at demo #12 and see if that displays correctly Also check /demo/phpThumb.demo.check.php to see if anything jumps out at you.

Failing that, you should set $PHPTHUMB_CONFIG['disable_debug'] = false to get the full debug output of the non-working server (perhaps of the working server as well for easy comparison). If you can't easily trace through the verbose output and find the problem, copy-paste them here and I'll see if I can spot the problem.

It almost certainly boils down to something lacking in either GD or ImageMagick, but what specifically I can't guess offhand.

Va1iant commented 6 years ago

Sorry for the very very late reply. I look at the places you're hinting, and I saw differences between both working and non-working server. Actually I got two non-working servers and both are using linux while my local working space is using windows. My working space (which is using xampp for windows) does not have imagick installed based on /demo/phpThumb.demo.check.php output, while the non-working ones has it installed but with warning note saying that the imagick version is 9 months old (see attachment)

image

Now what jumped out to me is the one server working doesn't use imagemagick while the ones don't are having it installed. So i gave a look at the phpThumb.config.php and see if I can disabled imagemagick and found these two settings and set it to false

$PHPTHUMB_CONFIG['prefer_imagemagick'] = false; $PHPTHUMB_CONFIG['imagemagick_use_thumbnail'] = false;

after i did this the one server that previously doesn't work is now working!

Anyway as you suggested I enable debug message when the issue was still observed and put it in attachment incase you want to figure out what happen (I'm also wondering). Thanks for the help!

dontwork.txt

Va1iant commented 6 years ago

James, do you want me to close this issue?

JamesHeinrich commented 6 years ago

No, please leave it open, it's something I need to look into. Apparently the ImageMagick codepath isn't handling transparency correctly.

JamesHeinrich commented 6 years ago

Marking as closed since presumably fixed by above. If not, please reopen this issue.