I tried to convert a movie (SWF) to Jpeg using getpixel then the jpeg image will be pass to show.php.
The show.php will be pop out in a new tab with the SWF converted already into a JPEG.
I want to save that image into MySql but i failed to insert it correctly.
Here is the Show.php code:
Can anyone help me how can i pass the $image to MySql database?
Im also planning to echo the stored image for later use.
Im still a newbie in PHP. Help and suggestions are really appreciated.
Thank you. God Bless.
The show.php will be pop out in a new tab with the SWF converted already into a JPEG.
I want to save that image into MySql but i failed to insert it correctly.
Here is the Show.php code:
Code:
<?php
$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" );
ImageJPEG( $image );
imagedestroy( $image );
?>
Im also planning to echo the stored image for later use.
Im still a newbie in PHP. Help and suggestions are really appreciated.
Thank you. God Bless.
Comment