View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Image Gallery from directory

Thread began 9/02/2009 5:54 pm by Carl | Last modified 9/03/2009 1:31 pm by Carl | 1037 views | 2 replies

anonymous

Hi Carl,

Sure thing... the first thing you want to do is build an array from the folder's contents.

You would use the "scandir" command, such as $imagegal = scandir('yourFolder');

Once you have the array, loop through it with something like a "for each" loop and then test to see if each file is an image. You have to do this because a lot of times, there will be hidden files in a folder for notes or other things.

You can test if it is an image simply by making an if statement with getimagesize. For example: if (getimagesize($loopIteration)

This works because if it is not an image, it won't create a value there.

So you could have inside your for each loop of the scandir array,

<?php


if (getimagesize($i)) { ?>

<div class"yourClass"><img src="/yourFolder/$i" /></div>

<?php } ?>


Let me know if you need more details... I only had a few moments to post this... I can send you an email later or post more details when I get home tonight.

Best regards,

Brian

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...