How to save image PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xyrhou
    New Member
    • Mar 2010
    • 14

    How to save image PHP

    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:
    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 );
    
    
    ?>
    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.
    Last edited by xyrhou; Mar 19 '10, 12:32 AM. Reason: No tags
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • xyrhou
      New Member
      • Mar 2010
      • 14

      #3
      Im sorry about that. I got carried away by my problem forgot to be aware of forum tags. I'll edit it. Thanks

      Sir do you have any idea how to pass the $image to the database?

      Comment

      • chathura86
        New Member
        • May 2007
        • 227

        #4
        check following links


        Heb je phpBB hulp? Vind op phpBBservice handleidingen, tips en een archief vol oplossingen. Al sinds 2006 dé Nederlandse phpBB forum bron!

        Comment

        Working...