SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Graphics

  1. #1
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Graphics

    I just found out that i can use graphics in php thing that made me very happy.
    Now... how can i insert this kind of graphic in a html page.
    For example i have a table and in one of those cells i want to insert an image created by a function like this:
    function draw ()
    {
    Header("Content-type: image/jpeg");
    $image = ImageCreate(200,200);
    $bgColor = ImageColorAllocate($image, 255, 204, 0);
    imagefill ( $image, 200, 200, $bgColor );
    $black = ImageColorAllocate($image, 0, 0, 0);
    $blue = ImageColorAllocate($image, 0,128,192);
    imagerectangle ($image, 1, 1, 199, 199, $blue );
    ImageLine($image, 1, 99, 50, 1, $blue);
    ImageLine($image, 50, 1, 99, 99, $blue);
    ImageLine($image, 1, 99, 99, 99, $blue);

    ImageJPEG($image);
    ImageDestroy($image);
    }

  2. #2
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    picture.php
    PHP Code:
    <?php

    // ... include your function
    draw();

    ?>
    index.html
    HTML Code:
    <img src="picture.php" alt="Dynamic Picture" />
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •