We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
Random Image Code
Topic Started: Jun 25 2005, 03:21 AM (986 Views)
ssj4rohan
Mr. Xile's the Best!
[ *  *  * ]
Can someone here tell me how to get a Random Image code to work? I've visited about 50 sites but couldn't get it to work. A friend of mine is using home.ripway.com but isn't telling me how to do it. Please help. Thanks.
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
Topic Moved to Coding and Scripting Chat
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
There are 2 or 3 working codes in this topic.

I'm sure one of them works for you :)
Offline Profile Quote Post Goto Top
 
ssj4rohan
Mr. Xile's the Best!
[ *  *  * ]
Thanks but I need a PHP Script :(
Offline Profile Quote Post Goto Top
 
Luke6006
Member
[ *  *  *  *  *  *  * ]
There's a few on http://www.pixel2life.com/tutorials/PHP_Co...e_and_Rotation/ :)
Offline Profile Quote Post Goto Top
 
ssj4rohan
Mr. Xile's the Best!
[ *  *  * ]
I know the sites they are on, can someone explain it to me?
Offline Profile Quote Post Goto Top
 
blakeo_x
Member Avatar
I cant believe its not PHP!
[ *  *  * ]
What are you trying to use it for? If it's a random image code for IF signatures, theyve patched it up pretty well (on this support forum, that is). I dont think there is a way to get them on signatures anymore unless you are trying to put it on some other board.
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
ssj4rohan
June 25, 2005 01:45 PM
Thanks but I need a PHP Script :(

Oh, that was in another topic I think.

Quote:
 

<?php
function random_image()
{
// Create an array with all the image url's in it.
$image_urls = array();
// Ad an img-url
$image_urls[] = http://some.domain.com/some_img_1.png;
$image_urls[] = http://some.domain.com/some_img_2.png;

// Check how manu images there are in the list
$image_count = count($image_urls);
// Randomly get a number from 0 to the number of images in the list.
$image_number = rand(0,$image_count);
// Use that number to get the image it belongs to from the array.
$chosen_image = $image_urls[$image_number];
// Return the url of the image.
return $chosen_image;
}
?>

To ad images, just ad lines like the ones in green and blue.
(Remember to put a ; at the end of every line!)
Now, where-ever you want a random image from that list, just do:
Quote:
 

<a href="<?php random_image(); ?>" />


Oh, the lines in orange can be deleted, (There comments, only usefull if you want to know what the lines do. They should explain it to you, if you wanna know)
Offline Profile Quote Post Goto Top
 
ssj4rohan
Mr. Xile's the Best!
[ *  *  * ]
Thats for a site, Thank you very much. Is it same for forum?
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
If you can put it in the scource code of the forum it is :r
(But if using IF, you'd have to go with a JavaScript code.)
Offline Profile Quote Post Goto Top
 
Luke6006
Member
[ *  *  *  *  *  *  * ]
How would you make it as a 'fake' image for a javascript image rotator for if?
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
Explain 'fake' to me, and I'll see if I can explain the rest to you :)
(Though JS + Qj == :X most of the time :P )
Offline Profile Quote Post Goto Top
 
Luke6006
Member
[ *  *  *  *  *  *  * ]
Fake, as in pretend, to make the forums reconise it as an image and not a code.
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
I think I can help you.

Do you mean so that there is a script inside of an image (like script.php) but since IF doesn't allow .php in signatures, make it a .gif? I can do that. If you want to use PHP on an IF board, I'd just use an iframe, but if you can work around it it's better, as iframes are very bad :(
Offline Profile Quote Post Goto Top
 
Luke6006
Member
[ *  *  *  *  *  *  * ]
I was meaning javascript.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1