2012-08-28 9 views
2

자바에서 색상을 가져 오는 투명한 배경을 가진 애니메이션 픽셀의 GIF 이미지를 만들고 싶습니다. 나는 이것을 사용했다 : http://www.phpclasses.org/package/3163-PHP-Generate-GIF-animations-from-a-set-of-GIF-images.html 그리고 : http://www.jeroenvanwissen.nl/weblog/php/howto-generate-animated-gif-with-php 그러나, 나는 문제가있다.애니메이션 GIF (PHP 포함)

<?php 
header ('Content-type:image/gif'); 
include('GIFEncoder.class.php'); 

// Open the first source image and add the text. 
$image = imagecreatefrompng('None.png'); 
imagesavealpha($image, true); 
$color = $_GET["sc"]; 
$r_bg = hexdec(substr($color,0,2)); 
$g_bg = hexdec(substr($color,2,2)); 
$b_bg = hexdec(substr($color,4,2)); 
$c1 = imagecolorallocate($image, $r_bg, $g_bg, $b_bg); 
imagesetpixel($image,36,24,$c1); 
imagesetpixel($image,36,25,$c1); 
imagesetpixel($image,36,26,$c1); 
imagesetpixel($image,37,26,$c1); 
imagesetpixel($image,38,26,$c1); 
imagesetpixel($image,38,25,$c1); 
imagesetpixel($image,38,24,$c1); 
imagesetpixel($image,37,24,$c1); 

// Generate GIF from the $image 
// We want to put the binary GIF data into an array to be used later, 
// so we use the output buffer. 
ob_start(); 
imagegif($image); 
$frames[]=ob_get_contents(); 
$framed[]=40; 

// Delay in the animation. 
ob_end_clean(); 

// And again.. 
// Open the first source image and add the text. 
$image = imagecreatefrompng('None.png'); 
imagesavealpha($image, true); 
$color = $_GET["sc"]; 
$r_bg = hexdec(substr($color,0,2)); 
$g_bg = hexdec(substr($color,2,2)); 
$b_bg = hexdec(substr($color,4,2)); 
$c1 = imagecolorallocate($image, $r_bg, $g_bg, $b_bg); 
imagesetpixel($image,34,23,$c1); 
imagesetpixel($image,34,24,$c1); 
imagesetpixel($image,34,25,$c1); 
imagesetpixel($image,34,26,$c1); 
imagesetpixel($image,34,27,$c1); 
imagesetpixel($image,35,28,$c1); 
imagesetpixel($image,36,28,$c1); 
imagesetpixel($image,37,28,$c1); 
imagesetpixel($image,38,28,$c1); 
imagesetpixel($image,39,28,$c1); 
imagesetpixel($image,40,27,$c1); 
imagesetpixel($image,40,26,$c1); 
imagesetpixel($image,40,25,$c1); 
imagesetpixel($image,40,24,$c1); 
imagesetpixel($image,40,23,$c1); 
imagesetpixel($image,39,22,$c1); 
imagesetpixel($image,38,22,$c1); 
imagesetpixel($image,37,22,$c1); 
imagesetpixel($image,36,22,$c1); 
imagesetpixel($image,35,22,$c1); 

// Generate GIF from the $image 
// We want to put the binary GIF data into an array to be used later, 
// so we use the output buffer. 
ob_start(); 
imagegif($image); 
$frames[]=ob_get_contents(); 
$framed[]=40; 

// Delay in the animation. 
ob_end_clean(); 

// Generate the animated gif and output to screen. 
$gif = new GIFEncoder($frames,$framed,0,2,0,0,0,'bin'); 
echo $gif->GetAnimation(); 
?> 

나는 16 진수 색상 코드를 얻을, 그때 RGB로 변경 : 는이 코드를 만들었습니다. 는하지만, 나는 이러한 오류를 얻을 :

<br /> 
<b>Notice</b>: Use of undefined constant ERR00 - assumed 'ERR00' in <b>D:\Testing\xampp\htdocs\Test\Test.php</</b> on line <b>75</b><br /> 
<br /> 
<b>Notice</b>: Use of undefined constant ERR01 - assumed 'ERR01' in <b>D:\Testing\xampp\htdocs\Test\Test.php</</b> on line <b>75</b><br /> 
<br /> 
<b>Notice</b>: Use of undefined constant ERR02 - assumed 'ERR02' in <b>D:\Testing\xampp\htdocs\Test\Test.php</b> on line <b>75</b><br /> 
<br /> 
<b>Notice</b>: Use of undefined constant ERR03 - assumed 'ERR03' in <b>D:\Testing\xampp\htdocs\Test\Test.php</b> on line <b>75</b><br /> 
GIF89a2 

내가 그 문제 모르겠어요. :/

답변

0

GIFEncoder 클래스를 확인하십시오. 정의되지 않은 변수가 있습니다. empty($for_all_vars);

을 확인하거나 this을 확인하십시오.

0

향후 참고할 수 있도록 오늘 오류가 발생했습니다. 10 세 이상 GIFEncoder 라이브러리에 잘못된 구문이 있기 때문에 발생합니다. $ERR 배열이 정의 된 경우 배열 키 주변의 따옴표가 없습니다.

올바른 코드가 있어야한다 :

var $ERR = Array (
    'ERR00'=>"Does not supported function for only one image!", 
    'ERR01'=>"Source is not a GIF image!", 
    'ERR02'=>"Unintelligible flag ", 
    'ERR03'=>"Does not make animation from animated GIF source", 
); 

(ERR03에 ERR00 주위에 따옴표를 참고 이러한 웹 주위에 떠 원본 파일에서 누락되었습니다.)

희망이 누군가를 돕는다.