Page 1 of 1

problems using simple functions from the gd library

Posted: Fri Jun 24, 2011 1:18 pm
by newuser56
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:

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

?>
Nothing happens here, but I know that $im is not null, so something is working.

Can you guys help me out?

Re: problems using simple functions from the gd library

Posted: Fri Jun 24, 2011 2:44 pm
by newuser56
lol nevermind.... there was an error in the for loop