Garry79
Suspended / Banned
- Messages
- 1,270
- Name
- Garry Ure
- Edit My Images
- Yes
In the process of teaching myself website coding I decided to recode my website. This went well and I was pleased with the results. Rather than stop there, I decided to see if I could get to the stage where all I have to do to update the gallery is add images to a folder and the thumbs would be created and the images added. This took me into a new world (for me) of PHP. I'd already managed to create the thumbs using CSS and I am using Slimbox for the gallery interface so I just needed to use PHP code to dynamically add the images.
Using the code below I managed to get to the stage where all my images from a folder are added to the correct div in the html code.
So far so good. My problem now is that Slimbox uses "title=" to caption each image and I'd like to be able to do this dynamically too. I was thinking of using IPTC tags or something similar but this is now getting beyond my abilities! :bonk:
I guess there's two options:
1) Do something clever with the PHP code
2) Do something clever with the Slimbox JS code
either way I'm stumped and could do with some help!
The problem page is http://www.garryure.co.uk/images.php
Using the code below I managed to get to the stage where all my images from a folder are added to the correct div in the html code.
Code:
<div id="right">
<?php
$dirname = "./photos";
$images = scandir($dirname);
$ignore = Array(".", "..");
foreach($images as $curimg)**
if(!in_array($curimg,$ignore)) **
echo "<a href='$dirname/$curimg' title='' rel='lightbox-$dirname'><img class='thumb' src='$dirname/$curimg' alt=''/></a>
";**
;**
?>
</div>
So far so good. My problem now is that Slimbox uses "title=" to caption each image and I'd like to be able to do this dynamically too. I was thinking of using IPTC tags or something similar but this is now getting beyond my abilities! :bonk:
I guess there's two options:
1) Do something clever with the PHP code
2) Do something clever with the Slimbox JS code
either way I'm stumped and could do with some help!
The problem page is http://www.garryure.co.uk/images.php