First for all, I want to say that I read lot of topic about transparent in PHP GD. Eg:
php GD create a transparent png image
Can PNG image transparency be preserved when using PHP's GDlib imagecopyresampled?
Even comment in manual. To prove that I don't just read, but try to understand, below I paste link to completely false comment which I found. He was wrote something quite opposite than is say in manual about imagesavealpha (You have to unset alpha blending (imagealphablending($i'm, false)), to use it.)
http://pl.php.net/manual/en/function.imagepng.php#85748
http://php.net/manual/en/function.imagesavealpha.php
I want keep transparent until I save image. Look at the code (it is just a eg):
$base = imagecreatetruecolor(500,500);
imagealphablending($base, false);
imagesavealpha($base, true);
$image = base64_decode($image);
$image = imageCreateFromString($image);
imagecopyresampled($base,$image,0,0,0,0,500,500,500,500);
//to this step I have transparent
//now if I save image everything is okay
$avatar = imagescale($avatar,101,101);//lost transpratent
imagepng($base,$savePath,0);
I know I can scale Image in imagecopyresampled() action, and don’t need 2 operactions. But I wrote above it’s just schema.
Could someone write how to preserve transparency after each operation.