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 30 November 2005, 08:27 PM
  #1  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
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?
Old 01 December 2005, 11:11 AM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
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
Old 01 December 2005, 11:15 AM
  #3  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default

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

well Id use asp, but thats all I use
Old 01 December 2005, 11:51 AM
  #5  
Dream Weaver
Scooby Regular
 
Dream Weaver's Avatar
 
Join Date: Feb 2000
Location: Lancashire
Posts: 9,844
Received 0 Likes on 0 Posts
Default

I'd go ASP as well, depends if you know it though.
Old 01 December 2005, 12:08 PM
  #6  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default

not as much as I would like - cant be much diff to php ?
Old 01 December 2005, 12:13 PM
  #7  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
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.
Old 01 December 2005, 12:22 PM
  #8  
NWMark
Scooby Regular
 
NWMark's Avatar
 
Join Date: Oct 2003
Location: Cheshire
Posts: 671
Likes: 0
Received 0 Likes on 0 Posts
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
Old 01 December 2005, 12:28 PM
  #9  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
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.
Old 01 December 2005, 12:57 PM
  #10  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
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
Old 01 December 2005, 05:20 PM
  #11  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
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.
Old 05 December 2005, 06:56 PM
  #12  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default

anyone?
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
hardcoreimpreza
Computer & Technology Related
21
11 October 2015 03:40 PM
Brumguy34
Subaru Parts
8
04 October 2015 07:51 PM
powerwrx
Non Scooby Related
21
03 October 2015 11:31 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
johnnybon
Subaru Parts
13
29 September 2015 10:47 PM



Quick Reply: random image script?



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