Announcement

Collapse
No announcement yet.

testing dynamic sig.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • LiquidManZero
    replied
    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.

    Leave a comment:


  • SolFire
    replied
    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");

    Leave a comment:


  • LiquidManZero
    replied
    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....

    Leave a comment:


  • SolFire
    replied
    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.

    Leave a comment:


  • LiquidManZero
    replied
    testing dynamic sig.

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

    Leave a comment:


  • SolFire
    started a topic testing dynamic sig.

    testing dynamic sig.

    Bleeeeeeeeeee *whaps Truly*
Working...
X