php gd - How to get and save THIS transparent image with PHP -


i trying image url, , save server. simple task, yeah, image has transparency... thing is, when save file pc or when try , save via php server, same result: image gets messed transparency set black. url of image is:

http://cellufun.com/p/avatarimage/agb.aspx?i=body|m04001|shirt|m10020|

another weird thing browser says image mime type image/png can't use imagecreatefrompng(); because "image not valid png" error...

here code (i did try other solutions, tryed last time):

<?php $result=file_get_contents("http://cellufun.com/p/avatarimage/agb.aspx?i=body|f04001|shirt|f10020|pants|mo55|"); $img = imagecreatefromstring($result); imagealphablending($img, true); imagesavealpha($img, true); imagecolortransparent($img);   header("content-type: image/png"); imagepng($img); ?> 

oh, , tryed image against copy() function, , still same result... looks image smaller in size original image... tryed this:

file_put_contents("files/test.png",file_get_contents($result)); 

and still not working... has image itself, because whatever try data, not work.

try code (changes @ lines 2-4):

<?php $img = imagecreatefromgif("http://cellufun.com/p/avatarimage/agb.aspx?i=body|m04001|shirt|m10020|"); $index = imagecolorexact($img, 0, 0, 0);  imagecolortransparent($img, $index);   header("content-type: image/png"); imagepng($img); ?> 

it works me although it's little trick ;) ..and don't know why quality worse..

ps: main problem see image @ url provided not png.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -