problems using simple functions from the gd library
Posted: Fri Jun 24, 2011 1:18 pm
Hey I've just started using the gd library but I just can't get it to work. What I'm trying to do here is open a .png file a read the color of it's pixels.
Here the code:
Nothing happens here, but I know that $im is not null, so something is working.
Can you guys help me out?
Here the code:
Code: Select all
<?php
error_reporting(E_ALL);
$im = imagecreatefrompng("image.png");
if (!$im)
die("error!");
for ($i = 0; $i < 20; $i++)
{
for ($j = 0; j < 10; $j++)
{
if (imagecolorat($im, $i, $j) != 0)
{
echo "$i $j\n";
}
}
}
imagedestroy($im);
?>Can you guys help me out?