NYCPHP Meetup

NYPHP.org

[nycphp-talk] help w/GD

Greg Faber greg at click3x.com
Thu Feb 12 17:30:18 EST 2004


Hello,

All I did was cut and paste this bit of code from php.net and I get a 
parse error at the if statement.
I don't really see whycome... do you?


function loadjpeg($imgname)
{
	$im = @imagecreatefromjpeg($imgname); // Attempt to open
    
  	if (!$im)
  	{ // See if it failed
          $im  = imagecreate(150, 30); // Create a blank image
          $bgc = imagecolorallocate($im, 255, 255, 255);
          $tc  = imagecolorallocate($im, 0, 0, 0);
          imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
          /* Output an errmsg */
          imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
     }
     return $im;
}




More information about the talk mailing list