Results 1 to 2 of 2
- 07-05-2007, 05:16 PM #1Member
- Join Date
- Jul 2007
- Rep Power
Random Image on Refresh (FROM Folder not set number)
I want to know how I can write a Java program for Random Image Rotation. Now I have looked online, spent time researching, however I cannot find exactly what I need.
I need a Random Image Script that will Display an image on my webpage (which when clicked on, links to the image). The image will change on Refresh. I want the script to be able to pull the random images from a folder "Images" and to randomly pick an image in the folder and display it. The images can be named whatever they want to be, and there is no limit/restrictions on numbers. all are .jpg though.
Anyone able to help me out? Since every bit of Java Random image rotation tutorials/scripts I find online are all where you have to either A: List all your images in the file, or B: Name every image the same way.
- 07-06-2007, 07:27 PM #2
I guess you are trying to do that with applets.
Applets are client side technologies. Because of that they can only access to the files on the server just like you access them with your browser (they cant explore your server in an easy way!). I guess this is why the existing examples requires you to have to either A: List all your images in the file, or B: Name every image the same way. So that client side will know the place of files and access them easily.
If you want to do that without above requirements, you will need to access a web server directory where your images will be placed. Get list of files from the HTTP response and parse the response to obtain names of the images! After obtaining the list of image names, i guess you already know how to select an image randomly.
Let us know if you need further help.
- By carlos123 in forum New To JavaReplies: 4Last Post: 01-17-2008, 10:44 PM
- By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 05:29 PM
- By ismailsaleh in forum AWT / SwingReplies: 1Last Post: 01-08-2008, 05:46 AM
- By romina in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:23 AM
- By fernando in forum New To JavaReplies: 1Last Post: 08-01-2007, 07:32 PM