RANDOM IMAGE SCRIPT

Started on the old forum in June 2006 · view the original in the archive · old links redirect here

21 replies · 1,987 views · started 20 years ago · 1 min read

4 participants
stretch Developer · 130 posts #1

Some posted this here i got a copy and just gona post it again

Create a folder for ur images, upload ur images to it. Create a file called "rotate.php" copy and paste this code 2 it and there u go! Simply link 2 http:// YourSite/images/rotate.php

<?php

$folder = '.';

$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';

$img = null;

if (substr($folder,-1) != '/') {
    $folder = $folder.'/';
}

if (isset($_GET['img'])) {
    $imageInfo = pathinfo($_GET['img']);
    if (
        isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
        file_exists( $folder.$imageInfo['basename'] )
    ) {
        $img = $folder.$imageInfo['basename'];
    }
} else {
    $fileList = array();
    $handle = opendir($folder);
    while ( false !== ( $file = readdir($handle) ) ) {
        $file_info = pathinfo($file);
        if (
            isset( $extList[ strtolower( $file_info['extension'] ) ] )
        ) {
            $fileList[] = $file;
        }
    }
    closedir($handle);

    if (count($fileList) > 0) {
        $imageNumber = time() % count($fileList);
        $img = $folder.$fileList[$imageNumber];
    }
}

if ($img!=null) {
    $imageInfo = pathinfo($img);
    $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
    header ($contentType);
    readfile($img);
} else {
    if ( function_exists('imagecreate') ) {
        header ("Content-type: image/png");
        $im = @imagecreate (100, 100)
            or die ("Cannot initialize new GD image stream");
        $background_color = imagecolorallocate ($im, 255, 255, 255);
        $text_color = imagecolorallocate ($im, 0,0,0);
        imagestring ($im, 2, 5, 5,  "IMAGE ERROR", $text_color);
        imagepng ($im);
        imagedestroy($im);
    }
}

?>

Here is a tip for you, if you upload these files to a folder called image.gif and rename rotate.php to index.php you will be able to use it on forums by using the url http://www.yoursite.com/image.gif and it will run the index.php previous post by GumSlone

Here is an example, eg your text file contains different text lines each is starting with ::

::Hello ::HI ::How are you ::Whazzup

$xfile = @file("text.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);

echo $udata[1]; //a random text line from the text file will be displayed

= = = = = The more you laugh...the longer you live. Read more jokes at http://fun-files.co.cc

subzero Super moderator Fellow · 3,954 posts #2

rambom link same way you posted

::[url="http://topsite.6te.net/top"]top-site-top[/url]
::[url="http://topsite.6te.net/downloads.php"]top-site-downloads[/url]
::[url="http://topsite.6te.net/sms.php"]top-site-free-sms[/url]
::[url="http://topsite.6te.net/upload.php"]top-site-uploads[/url]
$xfile = @file("text.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);

echo $udata[1]; //a random text line from the text file will be displayed

if having problems you can try this

make ram.php file put this in it ---

<?php

$xfile = @file("text.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);

echo $udata[1]; //a random text line from the text file will be displayed

?>

then add this to place you what it to show

<?
include('ram.php');
?>

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

lamar-wap #3

i have different random image script an it is much faster and easier

lamar-wap #6

you mean the one that clint posted External image (may be gone)

no i got a different one i will upload it but my scripts or jumbled on my pc i will sort it out later.......

hardstyle Developer · 154 posts #7

lamar why you always say something wrong with your pc when sum1 ask u to upload script ?

i think you talk bollox

8th wonder of the world

CLINT #9

lamar why you always say something wrong with your pc when sum1 ask u to upload script ?

i think you talk bollox

lol, uv got a good way with words and from the way u talk I think ur avatar is a real picture of u! hehe.

hardstyle Developer · 154 posts #10

lol clint, but i speak truth.. he ALWAYS she pc is broken or something to do with his pc.

8th wonder of the world

lamar-wap #12

i will be posting mine later ok guys...

abhisar #13

I have one and it works fine.

CLINT #14

i will be posting mine later ok guys...

hmmm, we'll see!

--Mike-- #15

POST IT LAMAR POST IT, I can't wait so it!!

subzero Super moderator Fellow · 3,954 posts #17

5 days and 10 hours and 600 mins and 23.4 sec days later still no upload lmao

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

hardstyle Developer · 154 posts #20

wow but oops thats the same script i used in the ealry stages of nochat script 😂

8th wonder of the world

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close