transparency - PNG composition using GD and PHP -
I'm trying to get a rectangular PNG and repeat the background and add depth using GD and it's 1 Pixels and 1 pixel right I am also trying to preserve a transparent background.
I have a bunch of troubles in protecting transparency.
Any help would be greatly appreciated.
Thank you!
$ obj = imagecreatefrompng ('rectangle.png'); $ Depth = 5; $ Obj_width = imagesx ($ obj); $ Obj_height = Images ($ obj); Image swords ($ obj, true); ($ Layer = $ depth; $ i ++) ($ layer = imagecreatefrompng ('rectangle.png'); Imagealphobalending ($ layer, wrong); Image Valvage ($ level, true) ; $ New_obj = imagecreatetruecolor ($ obj_width + $ i, $ obj_height + $ i); $ new_obj_width = imagesx ($ new_obj); $ new_obj_height = images ($ new_obj); Imagealphobalending ($ new_obj, incorrect); ImageWolf ($ new_obj, True); $ trans_color = imagecolorallocatealpha ($ new_obj, 0, 0, 0, 127); image file ($ new_obj, 0, 0, trans_color); Imagecopyresampled ($ new_obj, $ layer, $ i, $ i, 0, 0 , $ Obj_width, $ obj_height, $ obj_width, $ obj_height); // ImageWelpha ($ new_obj, true); // ImageWelph ($ obj, true);} header ("content-type: image / png"); imagepng ($ New_obj); imagedestroy ($ new_obj); PHP, GD The solution to virtually any related problem is using this small utility:
This is a PHP class based on GD ... but there are two "negligible" differences:
Very easy
Always work out
Two days ago I have a similar problem () but this library saves the day!
Comments
Post a Comment