Reputation: 179
I'm working on a script for which I need to do the following:
User uploads an image (JPG, PNG, GIF). PHP resizes it, increases the canvas size, and saves the images as a PNG file on the server.
Now I found this tutorial to learn how to do that: http://www.webxpert.ro/andrei/2009/01/08/thumbnail-generation-with-php-tutorial/
However, this will create a PNG file with a white background. Is it possible to have PHP generate it with a transparent background?
Thanks!
Upvotes: 2
Views: 2985
Reputation: 324840
The tutorial breaks it down into basic steps. Just find the step that puts a background colour in there, and put a transparent colour instead. You will need imagecolorallocatealpha
and an alpha value of 127.
Upvotes: 1