I have an embedded flash movie where users can draw any pictures they like.
I then want to allow users to be bale to save these images (stored on my server) so they can view them again at a later date.
I can send the information from flash to a new php page which dynamically displays the image but I can't figure out how to save the image.
Here is the code I have so far for dynamically displaying the image.
$data = explode(",", $_POST['img']);
$width = $_POST['width'];
$height = $_POST['height'];
$image = imagecreatetruecolor($width, $height);
$background = imagecolorallocate($image, 0, 0, 0);
// Copy pixels
$i = 0;
for($x = 0; $x <= $width; $x++) {
for ($y = 0; $y <= $height; $y++) {
$int = hexdec($data[$i++]);
$color = ImageColorAllocate($image, 0xFF & ($int >> 0x10), 0xFF & ($int >> 0x8), 0xFF & $int);
imagesetpixel($image ,$x ,$y ,$color);
}
}
// Output image and clean
header("Content-type: image/jpeg");
ImageJPEG($image);
imagedestroy($image);
Thanks for any help.