wie kan dit script werkend maken, het moet van een plaatje een ascii file maken, maar imagecreatefromgif werkt niet meer...
en php.net word ik ook niet wijzer van
<?
/*************************************************
* Converts GIF image into Pre formated html text
* Requires PHP works with GIF and GD library instaled
* Use: http://server/img2ascii.php?img=file.gif
*************************************************/
$path = "/www/htdocs/images/"; // Full path of the image files
/* http://www.php.net/manual/en/function.imagecreatefromgif.php */
$imgHand = ImageCreateFromGIF($path.$img);
/* http://www.php.net/manual/en/function.getimagesize.php */
$imgSize = GetImageSize($path.$img);
$imgWidth = $imgSize[0];
$imgHeight = $imgSize[1];
$htmlCode = "<pre>";
for ($l = 0; $l < $imgHeight; $l++) {
$htmlCode .= "\n";
for ($c = 0; $c < $imgWidth; $c++) {
/* http://www.php.net/manual/en/function.imagecolorat.php */
$pxlCor = ImageColorAt($imgHand,$c,$l);
/* http://www.php.net/manual/en/function.imagecolorsforindex.php */
$pxlCorArr = ImageColorsForIndex($imgHand, $pxlCor);
/* http://www.php.net/manual/en/function.dechex.php */
$htmlCor = DecHex($pxlCorArr["red"]) . DecHex($pxlCorArr["green"]) . DecHex($pxlCorArr["blue"]);
$htmlCode .= "<font color=\"#$htmlCor\">#</font>";
}
}
$htmlCode .= "\n</pre>";
header("Content-type: text/html \n\n");
print "<html><title>GIF 2 ASCII: $img</title>";
print "<body bgcolor=\"#00000\">";
print $htmlCode;
?>
en php.net word ik ook niet wijzer van
<?
/*************************************************
* Converts GIF image into Pre formated html text
* Requires PHP works with GIF and GD library instaled
* Use: http://server/img2ascii.php?img=file.gif
*************************************************/
$path = "/www/htdocs/images/"; // Full path of the image files
/* http://www.php.net/manual/en/function.imagecreatefromgif.php */
$imgHand = ImageCreateFromGIF($path.$img);
/* http://www.php.net/manual/en/function.getimagesize.php */
$imgSize = GetImageSize($path.$img);
$imgWidth = $imgSize[0];
$imgHeight = $imgSize[1];
$htmlCode = "<pre>";
for ($l = 0; $l < $imgHeight; $l++) {
$htmlCode .= "\n";
for ($c = 0; $c < $imgWidth; $c++) {
/* http://www.php.net/manual/en/function.imagecolorat.php */
$pxlCor = ImageColorAt($imgHand,$c,$l);
/* http://www.php.net/manual/en/function.imagecolorsforindex.php */
$pxlCorArr = ImageColorsForIndex($imgHand, $pxlCor);
/* http://www.php.net/manual/en/function.dechex.php */
$htmlCor = DecHex($pxlCorArr["red"]) . DecHex($pxlCorArr["green"]) . DecHex($pxlCorArr["blue"]);
$htmlCode .= "<font color=\"#$htmlCor\">#</font>";
}
}
$htmlCode .= "\n</pre>";
header("Content-type: text/html \n\n");
print "<html><title>GIF 2 ASCII: $img</title>";
print "<body bgcolor=\"#00000\">";
print $htmlCode;
?>