Reputation: 707
I have a default image that I want my users when they first create their profile to have, and I need to each one of them have a different background color but with the same base shape that will be in a png file, I can do this by creating for each background color create a png but I dont think it might be the best choice. How can I do this?
Upvotes: 1
Views: 5105
Reputation: 837
Use Imagick extension to work on your image. You can set a background color for your transparent png image by simply doing this
shell_exec("convert testimage.png -fill '#CCCCCC00' -opaque none image_wth_bgcolor.png");
This will give a slight gray(#CCCCCC) background to the the image. See this link.
Upvotes: 1
Reputation: 75
My suggestion is to create a png file for each colour (which seems to be the only way) and use PHP to randomly pick one of the images.
Upvotes: 1