Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
j4rdin
Worker
Worker


Joined: May 26, 2006
Posts: 153
Location: West Sussex - UK

PostPosted: Tue Jan 13, 2009 5:01 pm Reply with quote

I have found a random image block which loads all the image files in a directory into an array and then picks one at random to display in the block.

This works fine, but I would like to add an admin block which would allow me to either select a subdirectory and pass the value to the blocks script or better still scan a directory for any subdirectories and then pick one subdirectory at random and pass this value to the block to pick the image from that subdirectory to display.

At present I have a large number of images which I can't use in a gallery module and there are too many to load into one subdirectory.

John
 
View user's profile Send private message Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6792
Location: Ha Noi, Viet Nam

PostPosted: Thu Jan 15, 2009 12:27 pm Reply with quote

You could duplicate the code you already have to scan more directories and at the end use array_merge()
 
View user's profile Send private message Send e-mail
j4rdin
PostPosted: Thu Jan 15, 2009 1:50 pm Reply with quote

Guardian2003 wrote:
You could duplicate the code you already have to scan more directories and at the end use array_merge()


Wouldn't this just take the contents of one subdirectory (array) and add it to the end of the next subdirectory (array), in effect duplicating the result of putting all the images in one directory.

Or am I missing something?
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©