random image script?
#1
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?
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?
#2
Scooby Regular
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
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
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
#7
Scooby Regular
or stored the images in a db
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.
Trending Topics
#9
Scooby Regular
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.
#10
Scooby Regular
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
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
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
#11
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.
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.
Thread
Thread Starter
Forum
Replies
Last Post
hardcoreimpreza
Computer & Technology Related
21
11 October 2015 03:40 PM