1. DLP Flash Christmas Competition + Writing Marathon 2024!

    Competition topic: Magical New Year!

    Marathon goal? Crank out words!

    Check the marathon thread or competition thread for details.

    Dismiss Notice
  2. Hi there, Guest

    Only registered users can really experience what DLP has to offer. Many forums are only accessible if you have an account. Why don't you register?
    Dismiss Notice
  3. Introducing for your Perusing Pleasure

    New Thread Thursday
    +
    Shit Post Sunday

    READ ME
    Dismiss Notice

HowTo: A random sig pic

Discussion in 'Graphics Discussion' started by World, Jan 18, 2010.

  1. World

    World Oberstgruppenführer DLP Supporter Retired Staff

    Joined:
    Apr 19, 2006
    Messages:
    3,336
    Location:
    Axis of Evil (Original)
    Hi there, I'm World, and I'm going to show you how to create a signature with random pictures. Like mine! It's as easy as 1-2-3.

    So, what do we need? First, we start with a bit of webspace that supports php. If you don't have any, there are lots of free providers out there. I myself chose 000webhost.com, mostly by random chance.

    Then, we need some files. You can create all these with the Windows editor. Anything fancier is probably going to put stuff in there we don't want, like Word.

    Firstly, a file named ".htacces", in which we put
    Code:
    Redirect /avatar.gif /avatar.php
    Should be obvious what that does.

    Next, the "avatar.php".
    Code:
    <?php
    include("list.php");
    $filename = array_rand(array_flip($arr));
    $im = file_get_contents($filename);
    $ctype="image/png";
    header("content-type: $ctype");
    echo $im; 
    ?> 
    If you know your php (or html), you'll notice that this will only work for .png-files. It's the only type I use, and thus I didn't bother to include support for multiple types. (Well, I tried for 5 minutes and decided not to bother when it didn't work.) You can change it to anything from "image/jpeg" to "image/gif", but if you want multiples, well... tough luck ;)

    And, for one last file:
    Code:
    <?php
    $directory = "pics/";
    $arr = array();
    $images = glob("" . $directory . "*.png");
    foreach($images as $image)
    {
    	$arr[] = $image;
    }	
    ?>
    Here you can change the directory to whatever you want. I simply chose a sub directory called "pics". If you're changing the file type, you'll have to change it here as well.

    So, put all this on the server as well as the pictures, add the IMG-tag with the relevant info into your sig, like so
    HTML:
    [IMG]http://worldofg.net84.net/avatar.gif[/IMG]
    and there you are.

    Mind the sizes of the pictures though, hueg pictures will result in infractions and whatnot.

    If you find this to bothersome, send me the pics and I will hook you up. Or get the files here: http://worldofg.net84.net/avatar.zip