dimanche 19 avril 2015

How do I center an image (or increase the size of the image without stretching it) in PHP

Please dont mark this is duplicate guys, the closest entry is a year old with no answers. center an image when resizing an image and before imagefill.


I am using imagecopyresampled. Cropping, scaling etc is all working. Whats left is centering the image. For example if the image is too tall and narrow then I want to centre it inside the image. I can use the dst_x and dst_y params of the above function to shift it. I then get a black (or transparent band eventually) on the left or top.


How do I extend the destination image so that there is blank/empty/transparent space to the right or bottom of it. I have looked the the GD and image functions, nothing is jumping up at me.


Aucun commentaire:

Enregistrer un commentaire