+ Reply to Thread
Results 1 to 6 of 6

Thread: testing dynamic sig.

  1. #1

    Default testing dynamic sig.

    Bleeeeeeeeeee *whaps Truly*

  2. #2
    Join Date
    Jul 1999
    Posts
    4,893

    Default testing dynamic sig.

    Nice. What method are you using to randomize the images?

  3. #3

    Default testing dynamic sig.

    I have a series of images in a folder named 1.png, 2.png, 3.png and so on along with an index.php file that has the following:

    $dir = ".";
    $handle = opendir($dir);
    $count = 0;
    while (false !== ($file = readdir($handle))) {
    if (is_file($file) && $file !== '.' && $file !== '..') {
    $count++;
    }
    }

    $seed = round(rand(1,$count-1),1);

    $im = imagecreatefrompng($seed.".png");
    ///////////////////////////////////
    header("Content-type: image/jpeg");
    imagejpeg($im);

    I'm sure there's a better way to do this, but I was just throwing something together.

  4. #4
    Join Date
    Jul 1999
    Posts
    4,893

    Default testing dynamic sig.

    Ah, the way I'm doing it is this:

    <?
    $sig1 = "./lmz/sigs/1.png";
    $sig2 = "./lmz/sigs/2.png";
    $sig3 = "./lmz/sigs/3.png";
    $sig4 = "./lmz/sigs/4.png";
    $sig5 = "./lmz/sigs/5.png";
    $sig6 = "./lmz/sigs/6.png";
    $sig7 = "./lmz/sigs/7.png";
    $sig8 = "./lmz/sigs/8.png";

    $randomnumber = rand(1,8);
    $sigrandom = "sig$randomnumber";
    $sigimage = ${$sigrandom};

    // spit out the headers, then the image
    $opensig = fopen($sigimage, 'rb');
    header("Content-Type: image/png");
    header("Content-Length: ".filesize($sigimage));
    header("Pragma: no-cache");

    fpassthru($opensig);
    exit;
    ?>

    Seems to work well, and doesn't require the images to be in the same directory. Of course, the actual script I'm using does a couple more odd things....

  5. #5

    Default testing dynamic sig.

    hmm.. actually, it would be easier for me to use the readfile function than having it create an image.

    I changed it to:


    $dir = ".";
    $handle = opendir($dir);
    $count = 0;
    while (false !== ($file = readdir($handle))) {
    if (is_file($file) && $file !== '.' && $file !== '..') {
    $count++;
    }
    }
    $seed = round(rand(1,$count-1),1);

    header("Content-type: image/jpeg");
    readfile($seed.".png");

  6. #6
    Join Date
    Jul 1999
    Posts
    4,893

    Default testing dynamic sig.

    Hmm... I never knew about the readfile and readdir functions... Figures, I never actually went looking for such a thing. I might have a use for that, if I can remember what it was.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Testing Sig
    By Evolver in forum The Lounge
    Replies: 0
    Last Post: 01-12-2007, 10:55:54 PM
  2. Testing nothing
    By Ace in forum The Lounge
    Replies: 73
    Last Post: 11-01-2006, 05:04:01 AM
  3. testing
    By DarkSerge in forum The Lounge
    Replies: 2
    Last Post: 04-20-2006, 02:31:02 PM
  4. Re: Testing....
    By Amy in forum The Lounge
    Replies: 17
    Last Post: 08-11-2004, 12:48:32 AM
Collapse this box.

Visitors found this page by searching for:

Nobody landed on this exact page from a search engine, yet!

Posting Permissions

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