cleeclee Posted September 10, 2012 Share Posted September 10, 2012 Hello can anyone help me trouble shoot the code below. I'm having a syntax error on lines 4, 9 ,10 & 11. This code is to extract and reduce each frame of the gif image. I want to keep the gif image as jpeg as i resize it. I'm a total newbie at this. So i'm getting stucked too long and decided to ask for help. <?php $animation ="http://very-soft.com/media/products/screenshots/Energy_animation-site_1.gif; // link to the file $gifDecoder = new GIFDecoder ( fread ( fopen ( $animation, "rb" ), filesize ($animation) ) ); $delay = $gifDecoder->GIFGetDelays ( ); // get the delay between each frame // treatment of the reduced images 225x127 $i = 1; foreach ( $gifDecoder -> GIFGetFrames ( ) as $frame ) { fwrite ( fopen ( "C:\Documents and Settings\student.ISL-CPU-25\My Documents\resizegif\tmp_reduced" , "wb" ), $frame ); // write each frame in a temporary file $img = "C:\Documents and Settings\student.ISL-CPU-25\My Documents\resizegif\tmp_reduced\Energy$i.gif"; // File image location $newfilename = "C:\Documents and Settings\student.ISL-CPU-25\My Documents\resizegif\tmp_reduced\Energy2$i.gif"; // New file name $w = 225; // new width $h = 127; // new height resize($img, $w, $h, $newfilename); // function to reduce the image $i++; ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 10, 2012 Share Posted September 10, 2012 Please post your syntax errors, and use the code tags. If you're using an editor with syntax highlighting, some of your errors are obvious. See below. <?php $animation ="http://very-soft.com/media/products/screenshots/Energy_animation-site_1.gif; // link to the file $gifDecoder = new GIFDecoder ( fread ( fopen ( $animation, "rb" ), filesize ($animation) ) ); $delay = $gifDecoder->GIFGetDelays ( ); // get the delay between each frame // treatment of the reduced images 225x127 $i = 1; foreach ( $gifDecoder -> GIFGetFrames ( ) as $frame ) { fwrite ( fopen ( "C:\Documents and Settings\student.ISL-CPU-25\My Documents\resizegif\tmp_reduced" , "wb" ), $frame ); // write each frame in a temporary file $img = "C:\Documents and Settings\student.ISL-CPU-25\My Documents\resizegif\tmp_reduced\Energy$i.gif"; // File image location $newfilename = "C:\Documents and Settings\student.ISL-CPU-25\My Documents\resizegif\tmp_reduced\Energy2$i.gif"; // New file name $w = 225; // new width $h = 127; // new height resize($img, $w, $h, $newfilename); // function to reduce the image $i++; ?> Quote Link to comment Share on other sites More sharing options...
cleeclee Posted September 10, 2012 Author Share Posted September 10, 2012 Yes those are the errors that you've displayed. I'd like to know where did it go wrong and why are they highlighted, and how do i correct them? i'm really sorry in advance I do not know how to use these things well. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 10, 2012 Share Posted September 10, 2012 Then I suggest a basic PHP tutorial. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted September 10, 2012 Share Posted September 10, 2012 The PHP manual is a very good place to start. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.