SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: using imagegif

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using imagegif

    Hello

    Can anyone tell me how to force recreate the image when you use this...

    >imagegif($image);

    instead of taking the last image from the cache?

    any help much appreciated!
    Garrett

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I had the similar problem before. Here's the thread

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep i'm creating abstract random images on the fly, but essential same problem. That header code seems to do the trick! thanks!

    got one or two other things i am trying to do..
    in the code that produces my image (see below) i am creating a random positioned and sized grey triangle with fill on a white background (got me?). trouble is from time to time my triangle has no fill and occasionally the image is grey with a white triangle and i have no idea why its doing this? if any one has an idea i would greatly appreciate it!!

    a+
    Garrett



    --------------------------------------------------
    //create 6 random mumbers
    $number_one_x = rand() % 300;
    $number_one_y = rand() % 300;
    $number_two_x = rand() % 300;
    $number_two_y = rand() % 300;
    $number_three_x = rand() % 300;
    $number_three_y = rand() % 300;

    $the_max = max ($number_one_x, $number_two_x, $number_three_x); //gets the maximum x coordinate
    $the_min = min ($number_one_x, $number_two_x, $number_three_x); //gets the minimum x coordinate
    $the_middle_x = (($the_max - $the_min) / 2); //gets the middle between the max and the min
    $the_middle_x = $the_min + $the_middle_x; //adds the middle to the min to get middle of shape

    $the_max = max ($number_one_y, $number_two_y, $number_three_y); //gets the maximum y coordinate
    $the_min = min ($number_one_y, $number_two_y, $number_three_y); //gets the minimum y coordinate
    $the_middle_y = (($the_max - $the_min) / 2); //gets the middle between the max and the min
    $the_middle_y = $the_min + $the_middle_y; //adds the middle to the min to get middle of shape

    //draws a polygon
    $vertices = Array($number_one_x, $number_one_y, $number_two_x, $number_two_y, $number_three_x, $number_three_y); // set vertices
    ImagePolygon($image, $vertices, 3, $grey1); // draw pentagon
    ImageFillToBorder($image, $the_middle_x, $the_middle_y, $grey1, $grey1); // fill pentagon with green until it reaches grey border

    //visualise image
    header("content-type: image/gif");
    imagegif($image);
    imagedestroy($image);
    --------------------------------------------------


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
  •