photo_gallery
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
photo_gallery [2024/05/01 12:30] – admin | photo_gallery [2024/05/02 14:32] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== One File PHP Photo Gallery with EXIF Date and Time ==== | ==== One File PHP Photo Gallery with EXIF Date and Time ==== | ||
### | ### | ||
- | My attempt at a PHP Photo Gallery with code snippets and ideas leached from various sources around the net. The page layout and style of the ' | + | This is my attempt at a PHP Photo Gallery with code snippets and ideas leached from various sources around the net. The page layout and style of the ' |
### | ### | ||
Line 9: | Line 9: | ||
You may be able to tell I am not a CSS or PHP expert. I just wanted something small (how about 35 lines / 1.41Kb?) with low resources that would work for me and re-create the style of the old Kodak Slides I remember as a child. With this in mind I should caution you that this script may not adhere to the best practices in design and security. If your budgie dies as a result of using it, it's not my fault! | You may be able to tell I am not a CSS or PHP expert. I just wanted something small (how about 35 lines / 1.41Kb?) with low resources that would work for me and re-create the style of the old Kodak Slides I remember as a child. With this in mind I should caution you that this script may not adhere to the best practices in design and security. If your budgie dies as a result of using it, it's not my fault! | ||
### | ### | ||
+ | |||
+ | [[https:// | ||
+ | |||
=== Live Demo === | === Live Demo === | ||
Line 17: | Line 20: | ||
- Web server running Linux and Apache or Lighttpd plus PHP | - Web server running Linux and Apache or Lighttpd plus PHP | ||
- A directory source of .jpg images with lower case file names | - A directory source of .jpg images with lower case file names | ||
- | - < | + | - < |
=== Description === | === Description === | ||
### | ### | ||
- | This is pretty much a manual setup. The Photo Gallery does nothing but display | + | A single php script that generates thumbnail images and presents them in a 'contact sheet' style layout similar to the old Kodak slides as shown below. Clicking on the thumbnail opens the image in a new browser tab. Viewers own browser controls to close each tab. |
+ | ### | ||
- | <del>I may at some point look into how to auto generate the thumbnails | + | === The Code === |
+ | <code> | ||
+ | <?php $dirname=basename(dirname(__FILE__));?> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </style> | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | <div class=' | ||
+ | <? | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | | ||
+ | | ||
+ | foreach(glob(" | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | echo "<a href=' | ||
+ | < | ||
+ | | ||
+ | ?> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | === Installation === | ||
+ | ### | ||
+ | This is pretty much a manual setup. Copy the above into a file called index.php and drop this into your web image directory along with your main photos. You should also have a thumbnails | ||
+ | |||
+ | Note: the above is case sensitive .JPG is different | ||
You should also be aware that if you resize your main images some image programs will wipe out your EXIF data. I use [[https:// | You should also be aware that if you resize your main images some image programs will wipe out your EXIF data. I use [[https:// | ||
+ | |||
+ | That's it. Hope you find this useful. If you have any comments or suggestions for improvements please do let me know. (admint AT cpcnw DOT co DOT uk) | ||
+ | |||
+ | < | ||
### | ### | ||
photo_gallery.1714566651.txt.gz · Last modified: 2024/05/01 12:30 by admin