Acoon Posted August 12, 2011 Share Posted August 12, 2011 Hi all, Can anyone tell me why this fails and screw up the image? <?php $url = "http://eu.battle.net/wow/static/images/guild/tabards/emblem_100.png"; $im=imagecreatefrompng($url); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> Gives this instead of this: I'm not changing the image, just passing it through. Br, Acoon Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 12, 2011 Share Posted August 12, 2011 I just tested and got the same result, but then I opened photoshop and created a second png (from your original) and saved as PNG-8 (instead of (PNG-24) and it worked. Quote Link to comment Share on other sites More sharing options...
Acoon Posted August 12, 2011 Author Share Posted August 12, 2011 I just tested and got the same result, but then I opened photoshop and created a second png (from your original) and saved as PNG-8 (instead of (PNG-24) and it worked. Yeah, but the problem is that i can't download and keep all the graphics up to date. I rather pick it from the remote location. Is there any way to solve this? Br, Acoon Quote Link to comment Share on other sites More sharing options...
shlumph Posted August 12, 2011 Share Posted August 12, 2011 You'll probably need to use alphablending, since you're dealing with transparency: $url = "http://eu.battle.net/wow/static/images/guild/tabards/emblem_100.png"; $im=imagecreatefrompng($url); imagealphablending($im, true); imagesavealpha($im, true); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); http://www.php.net/manual/en/function.imagealphablending.php http://www.php.net/manual/en/function.imagesavealpha.php Quote Link to comment Share on other sites More sharing options...
Acoon Posted August 12, 2011 Author Share Posted August 12, 2011 You'll probably need to use alphablending, since you're dealing with transparency: $url = "http://eu.battle.net/wow/static/images/guild/tabards/emblem_100.png"; $im=imagecreatefrompng($url); imagealphablending($im, true); imagesavealpha($im, true); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); http://www.php.net/manual/en/function.imagealphablending.php http://www.php.net/manual/en/function.imagesavealpha.php Hi, thanks for the effort. But i already tried this also with no luck. Any other ideas? Br, Acoon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.