View Full Version : Make img from other imgs specified in array

09-19-2003, 10:36 PM

I'm trying to make a script where:

1) grabs info from a database - a number e.g. 001005001003004005

001: Base colour
first 005: Eye type and colour
001: nose type
003: mouth type
004: hair type
second 005: hair colour

2) Check to see if the image "001005001003004005.ext" exists

If it does exist, put it into an array.
if it doesn't, create it!

3) grab each corresponding image (each image has the exact same height and width)

4) Lay the images on top of each other to make a new image and
save as the file name as the one taken from the database.

I did a search and someone said that gif's cannot be opened, but if they were in png format could I specify the transparent colour in each layer and re-save as a png (i'm positive they support transparencies)

can anyone help?

EDIT: BTW I have version 4.3.2 of php and have ImageMagick installed

09-19-2003, 11:48 PM
GD Doesnt support png transparency but PNG does....

use Imagecreatefromgif if you need transparent image :-)

09-19-2003, 11:55 PM
gifs can be opened - just depends on the application used. Many stopped processing gifs due to unisys holding a patent on the LZW compression algorythm.

afaik php4.3.2 has GD2.0.12 bundled and a nasty glitch in the imagecopymerge function (fixed in 4.3.3rc3 GD2.0.15). I did a colourizer a while back that layers images together (shown here (http://www.teckis.com/scriptix/more/subpage/colourizer/teck.html)) though seem to remember it fubars due to that glitch so wouldn't be any good. Uses pixel iteration and ignores background colour so doesn't need transparency.

have never used imagemagick so cannot comment there.

09-20-2003, 12:09 PM
Perfect! :)
I really didn't expect it to work on my first attempt
Thanks! :thumbsup: