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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.