0

i am using gifencoder class but when i upload images it gives error

GIFEncoder V2.05: 0 Source is not a GIF image

below is the code

if (isset($_POST['speed'])) {
header('Content-type: image/gif');
if (isset($_POST['download'])) {
header('Content-Disposition: attachment;filename="animated.gif"');
}

include('GIFEncoder.class.php');

function frame($image) {
    ob_start();
    imagegif($image);
    global $frames, $framed;
    $frames[] = ob_get_contents();
    $framed[] = $_POST['speed'];
    ob_end_clean();
}

$cnt = count($_FILES);

for ($key = 1; $key <= $cnt; $key++) {
    $tmp_name = $_FILES["images" . $key]["tmp_name"];
    $im = imagecreatefrompng(file_get_contents($tmp_name));
    $resized = imagecreatetruecolor($_POST['width'], $_POST['height']);
    imagecopyresized($resized, $im, 0, 0, 0, 0, $_POST['width'], $_POST['height'], imagesx($im), imagesy($im));
    frame($resized);
}
$gif = new GIFEncoder($frames, $framed, 0, 2, 0, 0, 0, 'bin');
echo $gif->GetAnimation();
}

I have tried to chnage mode from 'url' to 'bin' but its not working.

sneha
  • 41
  • 5
  • an example would be a good start point ... input image output gif image and source code. Have you tried to decode the GIF? see what is wrong with it like missing header, wrong resolution, missing clear codes etc ... see [decoding GIF87a](http://stackoverflow.com/a/29924219/2521214) especially the 3MF sublink !!! – Spektre Aug 18 '15 at 13:58
  • you should also add the resulting image file here so we can see what is wrong with it... – Spektre Aug 19 '15 at 07:23

0 Answers0