Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (25 May 2013 - 09:50 PM) Hi, Agyat What's New?
@  yordan : (25 May 2013 - 07:59 PM) Yay, Shoutbox Is Back! Yahooo!
@  agyat : (24 May 2013 - 05:15 PM) O Dear, Where Are You? Without Your Words This Sb Is ..
@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.

Replying to Coppermine Random Image Script


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

Posted 02 May 2008 - 12:36 PM

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

Posted 02 May 2008 - 12:32 PM

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.

soleimanian

Posted 31 March 2005 - 04:15 PM

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

vizskywalker

Posted 29 March 2005 - 01:52 AM

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:
<?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]'>";
?>

dungsport

Posted 29 March 2005 - 01:23 AM

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

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.

vizskywalker

Posted 28 March 2005 - 04:30 PM

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).
<?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.

soleimanian

Posted 27 March 2005 - 04:56 PM

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

Review the complete topic (launches new window)