Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

random image script?

Thread Tools
 
Search this Thread
 
Old Nov 30, 2005 | 08:27 PM
  #1  
ChristianR's Avatar
ChristianR
Thread Starter
Scooby Regular
iTrader: (1)
 
Joined: May 2001
Posts: 6,329
Likes: 1
From: Europe
Default random image script?

Anyone have a random image script that can also check the domain?

Basically I have a few websites that all point to the same content.

I am after a random image script, that will see what domain is in the address bar, and display a random pic from a folder.

So come in from domain1.com, and you will get a random pic from /images/domain1/

domain2.com random pic from /images/domain2/

etc...

anyone know of one?
Reply
Old Dec 1, 2005 | 11:11 AM
  #2  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Default

you need to check the 'referrer' header iirc.

It would be very easy to do if, you had a list of the images stored in a db, or stored the images in a db

David
Reply
Old Dec 1, 2005 | 11:15 AM
  #3  
ChristianR's Avatar
ChristianR
Thread Starter
Scooby Regular
iTrader: (1)
 
Joined: May 2001
Posts: 6,329
Likes: 1
From: Europe
Default

Yeah I can do that - what would the code be? and what language are you thinking ?
Reply
Old Dec 1, 2005 | 11:27 AM
  #4  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Default

well Id use asp, but thats all I use
Reply
Old Dec 1, 2005 | 11:51 AM
  #5  
Dream Weaver's Avatar
Dream Weaver
Scooby Regular
25 Year Member
Liked
 
Joined: Feb 2000
Posts: 9,846
Likes: 4
From: Lancashire
Default

I'd go ASP as well, depends if you know it though.
Reply
Old Dec 1, 2005 | 12:08 PM
  #6  
ChristianR's Avatar
ChristianR
Thread Starter
Scooby Regular
iTrader: (1)
 
Joined: May 2001
Posts: 6,329
Likes: 1
From: Europe
Default

not as much as I would like - cant be much diff to php ?
Reply
Old Dec 1, 2005 | 12:13 PM
  #7  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
Default

or stored the images in a db
Don't do that Just store the locations, but a database is overkill.

HTTP_REFERER is client supplied, so you can't guarantee it will even be there. You should be able to get it the proper way using your CGI libraries.
Reply
Old Dec 1, 2005 | 12:22 PM
  #8  
NWMark's Avatar
NWMark
Scooby Regular
 
Joined: Oct 2003
Posts: 671
Likes: 0
From: Cheshire
Default

could you not rename the images by number and then just generate a random number tag .jpg or whatever on the end and display that.

Mark
Reply
Old Dec 1, 2005 | 12:28 PM
  #9  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
Default

You don't even need to do that, just read the directory, stick the filenames in an array, and return a random array index as the image filename relative to documentroot.
Reply
Old Dec 1, 2005 | 12:57 PM
  #10  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Default

depends how many file names you have really as to how bigger an array you want to use, hence my suggestion for a db.

You may even be able to do a for each file in folder and then refer to each file with an index, then query the index/object for file.name?

I didnt mean using a 'blob' I did mean just storing the path, just didnt word it like that!.

David
Reply
Old Dec 1, 2005 | 05:20 PM
  #11  
ChristianR's Avatar
ChristianR
Thread Starter
Scooby Regular
iTrader: (1)
 
Joined: May 2001
Posts: 6,329
Likes: 1
From: Europe
Default

I have a php script that you call as an img tag, and it displays random photos in that folder.

I guess I could create multi folders, and put the php script in each folder. Put some code in the html that will see the address in the address bar, and then pull the php script from that domains folder.
Reply
Old Dec 5, 2005 | 06:56 PM
  #12  
ChristianR's Avatar
ChristianR
Thread Starter
Scooby Regular
iTrader: (1)
 
Joined: May 2001
Posts: 6,329
Likes: 1
From: Europe
Default

anyone?
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
hardcoreimpreza
Computer & Technology Related
21
Oct 11, 2015 03:40 PM
Brumguy34
Subaru Parts
8
Oct 4, 2015 07:51 PM
powerwrx
Non Scooby Related
21
Oct 3, 2015 11:31 PM
Ganz1983
Subaru
5
Oct 2, 2015 09:22 AM
johnnybon
Subaru Parts
13
Sep 29, 2015 10:47 PM




All times are GMT +1. The time now is 10:39 AM.