1. Hey Guest,

    Are you handy with Photoshop? Do you feel the DLP Anakin logo is tired and old? Do you want to win a special as of yet undetermined prize? Join the DLP Banner Photoshop Competition! Fame, fortune, and the respect of your peers await those that enter. Sadness, despair, and a deep self-loathing await those that do not.

    Enter the competition.
    Dismiss Notice

HowTo: A random sig pic

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

  1. World

    World Oberstgruppenführer Moderator DLP Supporter

    Apr 19, 2006
    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
    Redirect /avatar.gif /avatar.php
    Should be obvious what that does.

    Next, the "avatar.php".
    $filename = array_rand(array_flip($arr));
    $im = file_get_contents($filename);
    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:
    $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
    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