Coppermine Random Image Script

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > Miscellaneous Scripting Languages & Ideas

Coppermine Random Image Script

soleimanian
hi
i need a script to display random image of coppermine on my index

Reply

vizskywalker
If you have the ability to use PHP, it is easy to make a random image script. Give each picture the same name but with a number at the end of it (make foo.bar foo1.bar footype.bar foo2.bar). Then stick the following code anywhere in the page and make sure the page is a .php type.(The instructions are in the comments).
CODE
<?php
$min = 1; //The first number one of your images has
$max = 10; //The highest number you image has
$number = rand($min, $max);
$url = "http://www.foo.bar/images/foo" . $number . ".bar"; //change the url to your url //for the image split the url into two parts by separating in between the image name and //extension
echo "<img src='$url'>";
?>


That ought to do it.

Reply

dungsport
Here, another way if you'd like to use javascript on your page.

QUOTE
The steps involved in randomly displaying an image from a set are very similar to those used for displaying random text strings.

1. Initializing an array
2. Storing the image file names in that array
3. Finding the length of this array
4. Using the Math.random() to generate a random number
5. Using the randomly generated number as index for retrieving an image file name from the array.
6. Displaying the image.

var img_name = new Array("purple.gif", "red.gif",
"blue.gif", "yellow.gif", "green.gif", "pink.gif");

var l = img_name.length;

var rnd_no = Math.round((l-1)*Math.random());

document.r_img.src = img_name[rnd_no];

<IMG SRC="blank.gif" WIDTH="100" HEIGHT="50"
NAME="r_img" ALT="Random image">


They are just a simple one, you could find a lot more on the net through Google.

This matter could also be done in Flash which is flashier but not really easy to do. Tutorial of how to do it can be found through search engines too. Check out www.flashkit.com if you are serious to Flash.

 

 

 


Reply

vizskywalker
If you want to use php instead of javascript (and I'm not saying either's better), but want the javascript ability to have totally different names, you can use this code:
CODE
<?php
$location = "http://blah.blah.foo/foobar"; //this should be the folder containing the //images if they are in separate folders, ignore this line and make the full location of the //images the replacement for pic#.ext in the next line
$pictures = ("pic1.ext", "pic2.ext", "pic3.ext"); //make pic#.ext the name of one of your //images no rules as to format of the name this time
$maxnum = count($pictures);
$randnum = rand(0, maxnum-1);
echo "<img src='$pictures[$randnum]'>";
?>

Reply

soleimanian
thanks
but i need a script to show random pictures from coppermine database like IPB Portal that use cookies,username and password field and ...

Reply

iGuest
i want do the randomly change image without the random() function so how can i do
Coppermine Random Image Script


This is my code . So I want the code which will work without random function.

Reply

iGuest
i want the code without random() function.
Coppermine Random Image Script

I m using this code for randomly change the image .






-question by Ravi Jadaun

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. random images coppermine - 6.22 hr back. (1)
  2. random pictuires in html format - 9.03 hr back. (1)
  3. random coppermine - 25.74 hr back. (1)
  4. .html random picture - 32.32 hr back. (1)
  5. random image script - 35.02 hr back. (1)
  6. random image changer html code - 39.51 hr back. (1)
  7. coppermine no random - 42.75 hr back. (1)
  8. coppermine random image script - 51.18 hr back. (1)
  9. html and auto display images and random - 51.21 hr back. (1)
  10. html show random picture - 53.96 hr back. (1)
  11. how to change images in coppermine - 56.54 hr back. (1)
  12. coppermine random picture - 88.45 hr back. (1)
  13. flash random image script - 92.09 hr back. (1)
  14. php random image script - 99.98 hr back. (1)
Similar Topics

Keywords : coppermine random image script

  1. Startup Cleaning Script - Can anyone help? (1)
  2. Auto-KeyWord Generating Script. - (5)
    Well, for better search engine optimization, I had created a AUTO-KEYWORD generating script. The
    following was the procedure that I followed.. Read the entire contents. Converted it into String.
    Removed the HTML Tags and the Whitespace characters Filtered out only valid words without special
    characters ( only hypen permited ) Once all the filtering process was done, General words like
    "the", "a" etc was removed After that, the string was converted into Array. Using the callback of
    the following function, I calculated the Frequency of the words. Then The Top 15 words ...



Looking for coppermine, random, image, script

Searching Video's for coppermine, random, image, script
advertisement




Coppermine Random Image Script



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE