|
Posted by shimmyshack on 03/03/07 18:19
On 3 Mar, 15:20, Fred Atkinson <fatkin...@mishmash.com> wrote:
> Folks,
>
> I found another script that does the job. It needs a little
> tweaking, but the code is simple enough that I can do that without too
> much trouble.
>
> The script I found is at:http://www.theprojects.org/scripts/Get_Image_List/in case you'd like
> to have a look at it.
>
> Regards,
>
> Fred
as you modify it, try to think of how efficient it will be, if I were
you and I wanted to call this script many times in a webpage, I would
definately build the array, and thin it down to the humber of images
you need in yout page, then stat the images, and also use its "return
the array of images" option, but extend the array to add the width and
height and alt, then you will have excatly what I was on about before.
The reason why returning an array is a good idea, is that you read the
dir once, and then have the details of the all the images. Then when
you put these details into the html, your users will request each in
turn and the server will go get each. This way you dont hit the disk
so much. If you have a great many images, You should split them as you
seem to have done, by directory to improve response time.
If all that seems little boring, welcome to programming where you do
well to think of every tiny thing, it is a good habit to get into. Of
course there are a few problems with this approach - not the least of
which is returning an array of a set number of images (because its
faster) but perhaps adjusting your html later to include more images.
For this reason you might like to call the function many times
returning on one each time, but on a very busy system this makes
things slow and also this kind of habit decreases the life of your
hard disk. zzZ
Navigation:
[Reply to this message]
|