Hi,
This is regarding automating image gallery display.
We have directory tree as follows,
Root directory = ../image
Folders under image = event1, event2, event3... etc
Folder under every event = thumb
Basically we have all the photos grouped in 'event' folders and corresponding thumb nails are under 'thumb' folder.
We are using lightbox to display photos. Following is the code given by lightbox folks.. I have to copy / paste it multiple times to display all the photos stored in the event folder. The HTML tag is as follows,
<a href="/image/08_event1/08_event1_01.JPG" rel="lightbox[roadtrip]"><img border="0" src="/image/08_event1/thumb/t_08_event1_01.JPG" width="100" height="80"></a>
Is there PHP code available to automate this image linking process and embed above syntax ?
I am a non IT guy and using the light box tool to display various photos for one non profit social club.
Thanks for your time and help.
PHD code to automate image linking..
Moderator: General Moderators
Re: PHD code to automate image linking..
Try something like this:
Code: Select all
//read contents of directory into an array
if ($handle = opendir("image/08_event1")) {
while (false !== ($image = readdir($handle))) {
$imageArray[] = $image;
}
}
//sort array
sort($imageArray);
//loop through array echoing HTML for the display of each image.
foreach($imageArray as $image){
echo "<a href=\"image/$image\" rel=\"lightbox[roadtrip]\"><img border=\"0\" src=\"image/thumb/t_$image\" width=\"100\" height=\"80\"></a> ";
}
Re: PHP code to automate image linking..
Hello omniuni,
Thank you for your prompt response.
I included your code last week and works great.
Thank you very much for support.
Mukund.
Thank you for your prompt response.
I included your code last week and works great.
Thank you very much for support.
Mukund.