creating image with PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • cosmiclove
    Sergeant Major

    • Oct 2007
    • 90

    creating image with PHP

    Hi there,

    Could you please tell me what is wrong with this php code? It is copied from an O'reilly PHP book, but when i place it in my browser, i get an error message on the 7th or 8th lines.
    PHP Code:
    <? 
    header("content-type: image/png");
    $image = imagecreate(400,300);
    $gold = imagecolorallocate($image, 255, 240, 00);
    $white = imagecolorallocate($image, 255, 255, 255);
    $color = $white;
    for ($i = 400, $j = 300; $i > 0; $i -= 4, $j -= 3) {
    if ($color = = $white) {
    $color = $gold;
    } else {
    $color = $white;
    }
    imagefilledrectangle($image, 400 - $i, 300 - $j, $i, $j, $color);
    }
    imagepng($image);
    imagedestroy($image);
    ?>
    Thanks much for your help,
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: creating image with PHP

    if ($color = = $white) {

    Remove the white space between the two "=" signs:

    if ($color == $white) {
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • cosmiclove
      Sergeant Major

      • Oct 2007
      • 90

      #3
      Re: creating image with PHP

      Naval=Genius!
      Me=silly
      Thanks, man!

      Herman

      Comment

      Working...
      X