Jump to content

trouble shooting


cleeclee

Recommended Posts

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++;

 

?>

Link to comment
https://forums.phpfreaks.com/topic/268200-trouble-shooting/
Share on other sites

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++;
   
?>

Link to comment
https://forums.phpfreaks.com/topic/268200-trouble-shooting/#findComment-1376604
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.