Hi this is my first post. I found this site through the need of a php script for my website. Now I'm not much of a coder, I can just about get by ish.

I have a website www.saltashcameraclub.co.uk I have built this site using E107 mainly because I have used it before and I knew what I was doing. However it doesn't do everything I want.

The script I require needs to be able to generate random images from a top level directory and its sub directories, ( i.e membersimages/member1 membersimages/member2 membersimages/member3) and not only that but I would like to be able to control the height of the image while maintaining the aspect ratio.

Thank you for taking your time to read this and I hope you can help.

Recommended Answers

All 4 Replies

The separate parts are probably not that difficult. There are a lot of samples on this site on how to traverse a folder in php. Personally, I use phpThumb for thumbnail sizing and caching. The next problem is probably, what are you going to do with it ? Does it need to become and image slider on your page ? That would mean you'd have to make an e107 plugin of the parts.

Hi Thanks for the reply,

My idea is to have one random image on a splash page at the beginning of the site, I wanted to draw the random image from the members galleries that way no one person gets favoured

Have a look at this: http://php.net/manual/en/function.opendir.php
The examples in the comment show how you can read recursive directory contents. To avoid having to do this everytime someone loads your page, you should cache these results (perhaps in a plain text file), so they can be easily reloaded. You could refresh this file once a day (this all depends on your traffic). H.t.h.

thank again for the reply I have been over and had a look and I must admit to feeling a little bit overwhelmed with the information. It might take a little time to work through this.

If I am honest I was hoping to be pointed to a script that just needed a little tweaking as I am just learning the basics of php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.