Shoutbox

Hosting Random Images! - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: General (/forumdisplay.php?fid=11)
+---- Forum: General Chit Chat (/forumdisplay.php?fid=14)
+----- Thread: Hosting Random Images! (/showthread.php?tid=60019)

Hosting Random Images! by .Roy on 06-01-2006 at 01:15 PM

Well this time im not hosting it using KSMAS so you will need to send me your images via email.


Add me to msn messenger : blattr[at]gmail.com

and ill host it.


RE: Hosting Random Images! by M73A on 06-01-2006 at 01:15 PM

(L) ROY (L)

lol:P

yay random avatar up again.


RE: Hosting Random Images! by user27089 on 06-01-2006 at 01:19 PM

Why don't you just use this script:

code:
<?php
$dir = "imgs";
$dh = opendir($dir);
$files = array();
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
array_splice($files, 0, 2);
srand( (double) microtime()*1000000 );
$key = array_rand($files);
readfile($dir . "/" . $files[$key]);
?>

Make a folder called "avatar" on your server, for example http://skarz.co.uk/avatar/ then in that folder put that code in a .php file (this is where you will link the image to, ie. http://skarz.co.uk/avatar/random.php will go in the avatar url box in the user cp). The images that you want shown should go in the "imgs" folder: http://skarz.co.uk/avatar/imgs.

I doubt it would be that hard to just make seperate folders for different people. You can't be hosting that many people :p.
RE: Hosting Random Images! by .Roy on 06-01-2006 at 01:32 PM

thats what im doing traxor im using your script =.=.


RE: Hosting Random Images! by user27089 on 06-01-2006 at 04:11 PM

The script isn't mine, I think it was made by Plik a few years ago.


RE: Hosting Random Images! by Plik on 06-01-2006 at 06:25 PM

Please don't use tractors version, but us this one insted:

code:
    <?php
    $dir = "imgs";
    $dh = opendir($dir);
    $files = array();
    while (false !== ($filename = readdir($dh))) {
    $files[] = $filename;
    }
    sort($files);
    array_splice($files, 0, 2);
    srand( (double) microtime()*1000000 );
    $key = array_rand($files);
    header("location: $dir/".$files[$key]);
    ?>

The difference?
This version allows give the browsers a chance to cache the images :P
RE: Hosting Random Images! by ayjay on 06-01-2006 at 09:27 PM

Plik, I am now about to tell you what you need to do:

Are you ready?...

Comment it!

"Why?" I hear you ask. Here's the answer...

So ajd can leeeeeeearn!!!


RE: Hosting Random Images! by Eljay on 06-02-2006 at 07:57 AM

you people use too much code :(

code:
<?
$images = glob("./images/{*.gif,*.jpg,*.png}", GLOB_BRACE);
header("Location: ".$images[rand(0,count($images)-1)]);
?>

:cheesy:
RE: Hosting Random Images! by John Anderton on 06-02-2006 at 09:10 AM

quote:
Originally posted by Eljay
you people use too much code :(

code:
<?
$images = glob("./images/{*.gif,*.jpg,*.png}", GLOB_BRACE);
header("Location: ".$images[rand(0,count($images)-1)]);
?>

:cheesy:
(Y)

Mine is better but lets just leave that for another time shall we :P

Should i comment it (plik's thingo) for you gayjaydee ? :P
RE: Hosting Random Images! by ayjay on 06-02-2006 at 12:57 PM

NO


RE: Hosting Random Images! by callmegarfield on 04-04-2007 at 02:30 PM

So... which one should I use?

Tried all three and there's a blank patch instead of an avatar :(
<<---


RE: Hosting Random Images! by Zahid™ on 04-04-2007 at 02:42 PM

quote:
Originally posted by callmegarfield
Tried all three and there's a blank patch instead of an avatar :(
<<---
Follow traxor instructions:
http://shoutbox.menthix.net/showthread.php?tid=60...d=657680#pid657680
RE: RE: Hosting Random Images! by callmegarfield on 04-04-2007 at 02:59 PM

quote:
Originally posted by Zahid™
quote:
Originally posted by callmegarfield
Tried all three and there's a blank patch instead of an avatar :(
<<---
Follow traxor instructions:
http://shoutbox.menthix.net/showthread.php?tid=60...d=657680#pid657680


I have done, I used Macromedia Dreamweaver MX to save the .php file and i've made the \imgs folder and all, and i have a blank space.

ah there's a picture there now, after using Plik's