Load GIFs and PNGs into Flash

Well, have you ever wanted to load a GIF or PNG into your Flash movie? Well now its possible. Here is the code for GIFs

<?

header("Content-type: image/jpeg");

$file = $_GET['file'];

$im_copy = ImageCreateFromGIF($file);

$x = ImageSX($data);
$y = ImageSY($data);

$im = ImageCreateTrueColor($x, $y);

ImageCopyResampled($im, $im_copy, 0, 0, 0, 0, $x, $y, $x, $y);

ImageJPEG($im);
ImageDestroy($im);

?>

To implement this you would do something like:

loadMovie("gif2jpg.php?file=MyGIFfile.gif");

to load PNGs the code is nearly identical. You only have to change this line:

$im_copy = ImageCreateFromGIF($file);

to

$im_copy = ImageCreateFromPNG($file);

*** I wasn’t really sure what you guys wanted to do with this. If you wanted to do anything. Its just something small. Not really a tutorial. It just outputs the GIF/PNG image as a JPEG.

Just thought someone might be interested by it if you weren’t already aware of it. :slight_smile: Let me know.