GIFEncoder V2.05:0源不是GIF图像

时间:2015-08-18 12:06:50

标签: php image-processing

我正在使用gifencoder课程但是当我上传图片时会出错

  

GIFEncoder V2.05:0来源不是GIF图像

下面是代码

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();
}

我尝试过从'url'到'bin'的chnage模式,但它无效。

0 个答案:

没有答案