Updated 10/27/2008 — Read more below!
There are a lot of PHP photo gallery scripts out there. I know; because I went looking for one some time ago, and found myself barraged with Javascript, AJAX, and complicated installations. I didn’t want any of those things, so in the end I just wrote one for myself — and this is the end result. Download the ZIP package.
It’s not a complicated script, and it doesn’t do a whole lot for you: but, assuming you’re running on Linux with PHP, it’ll be incredibly easy for you to install and configure. View the sample installation.
What’s in the Package?
There are six main files included in this zip package (Version 1.2):
gallery.php— the photo gallery script.index.php— the home file which includes the gallery script and contains configuration info. You can copy this page to create additional galleries just by saving it with a new name and changing the configuration information.titles.txt— a simple text file which uses pipe-separated fields to indicate the image name, an image description, and analttext option.title.php— a script which provides a unique title element for each image in the gallery.basic_styles.css— a very basic stylesheet so that your default photo gallery doesn’t look too boring. Warning: no attempt whatsoever has been made to test these styles outside of Firefox.readme.txt— installation instructions
I’ve also supplied a (very) small gallery of images for the included gallery.
What does the script do?
This is pretty straightforward. The configuration information you’ll send to the script provides the title of the gallery, the relative path to your images folder, and the name of your text file containing the image information. Using this information, the gallery script creates a page containing (in order):
- Navigation links to move between the previous and next images in the gallery. The sequence is the order in which you’ve listed the images in your text file. The navigation is circular, so in the initial position the previous link will send you to the last image in the gallery.
- A full size image with a caption. The caption is the second field in your text file.
- An unordered list of thumbnail images in the gallery. Again, the order is from the text file. In the default styling, the list is displayed as a panel of images rather than as a list. Each image is a link to the full sized image within the gallery.
The script does NOT automatically generate your thumbnail images. Sure, I could have done that — - but my feeling is that manually creating thumbnail images will usually be more aesthetically pleasing. My preference is to create 80×80 square thumbnails cropped from the image. The tiling effect of the unordered list is much more effective with square thumbnails; and the ability to choose a particular section of the image for the thumbnail is much nicer than whatever programmatically selected truncation might have done.
Some Small Recommendations
The script allows the ability to use an alt text on your images. It also provides a description which can be used to caption the images in a paragraph either over or under the image. To me, it’s redundant to provide both descriptive text associated with the image AND a descriptive alt attribute. Therefore, I’ve also provided the option to turn off alt text in the full sized images. The default settings are what I’d recommend: visible descriptions enabled for the full size image, alt attributes left blank, and alt attributes enabled for all thumbnails.
I also recommend keeping your alt attributes short and to the point. The reason for having separate descriptions and alt attributes is because they serve different purposes: don’t try and use the description field as an alt attribute and don’t try and use the alt field for a description!
There’s nothing fancy about this script. Really — I mean it. It’s down and dirty “make me a photo gallery” programming. Use at your own risk!
Changes as of 10/27/2008
- Added a pagination feature, allowing you to set the number of thumbnail which will display at one time.
- Added a few minor display options, to more easily move or remove elements such as skiplinks, change the text for previous/next labels, etc.
The changes are relatively uninvasive, but you will need to add the new options into your existing gallery index pages. Other files can simply be overwritten; but be careful not to overwrite your titles.txt files!
Changes from 7/7/2007
I’ve made a number of small changes, including correcting some missing closing tags (oops!). The biggest change is that the Easy PHP Gallery is now capable of being a bit more search friendly. I’ve done a little rewriting to make the script capable of providing unique title elements for each image, rather than just giving the main gallery page title for every single page. This does make the script a tiny bit more difficult to implement, I suppose — but I’d say it’s worth it.

Great job, Joe! That’s really quite nice. I will probably use that at some point, depending on the situation.
I was considering using my AutoRun as a gallery (the automatic part might be cool). I have used Thierry Koblentz’s easyAlbum since it’s pretty good albeit complex to install I think. I only used Thierry’s once, but it was modded heavily at the client’s request which actually made my life miserable for a few days.
I think one of your photos is missing by the way: “a1”
Comment by Mike Cherim (105 comments.) — March 20, 2007 @ 10:14 am
Thanks, Mike. I’ve looked at Thierry’s, too — - but just didn’t want to deal with the complexity. I just didn’t WANT more from the script. My principle use for this is putting personal photos online for my family, actually — - and I found that the longer it took the less likely I was to do it!
By the way, while I was checking on that missing photo (more accurately, it was a “present and not supposed to be” entry in the titles file…), I found an error in the script - a variable which I inconveniently misnamed between the configuration and the gallery script. Somehow made it not quite work right…
Only matters to the first 9 copies downloaded.
Comment by Joe Dolson (596 comments.) — March 20, 2007 @ 10:31 am
Yeah I tried installing a photo gallery on a clients website/ blog the other day and it did not work, so I will defiantly have to have a look at this. Thanks for sharing :)
Comment by Jermayn Parker (12 comments.) — March 20, 2007 @ 6:34 pm
Thanks, Jermayn - hope you’re able to find it useful!
Comment by Joe Dolson (596 comments.) — March 20, 2007 @ 11:23 pm
Slight change to the script made to improve security — - effects the first 98 downloads.
Comment by Joe Dolson (596 comments.) — April 6, 2007 @ 11:14 am
Hi, Joe:
How are you. I am trying to use your code of “Easy PHP Gallery” for my small business application, such as to show a small stores products on their sites.
I see you have limitation of the scripts for “non-commercial” use. Can you give me a price or something for my commercial use of your scripts?
Sincerely
Shuya Huo
P.S. I also sent you an email regarding a question for your another design work for a gallery business. Look forward to hear from you too.
Comment by Shu (1 comments.) — July 14, 2007 @ 1:13 pm
Hi, Shu - Thanks for your comments. I don’t seem to have received your email, but I’ll send you a message shortly.
Comment by Joe Dolson (596 comments.) — July 14, 2007 @ 3:18 pm
I have downloaded and uploaded your script to my web host server. My question is as follows. I have an album that has 4 pictures. Which file do I need to update so that after the forth picture it does not continue to go to ex: PHP?a=4/php?a=5/php?a=6 etc?
Other than this, this is a great script!
Comment by Alex Martinez — August 6, 2007 @ 4:56 pm
Well, that’s curious. Can I see your implementation? That’s definitely not what should be happening…after the last image in the titles.txt file, it should wrap around to come back to the first image! (As you can see in my example script.
Does your titles.txt file have blank lines after the final image? The file navigation script will read blank lines as if images were occupying them; so you have to make sure there aren’t any hard returns after the final image.
Comment by Joe Dolson (596 comments.) — August 6, 2007 @ 5:05 pm
What to do if thumbnails are not showing up?? i have the in the same folder as my full size photos and are named filename_tn.jpg any ideas??
Comment by James — August 16, 2007 @ 6:49 pm
Are you using an absolute path in for the variable
$path? The path variable is used in anis_file()function, which doesn’t accept absolute paths in PHP versions below 5.0. If you change it to a relative path, that would probably help.Comment by Joe Dolson (596 comments.) — August 17, 2007 @ 10:20 am
Thanks for the help, it was a start i had it wrong. but after correcting the $path, it still didn’t working we found in the gallery.php script that the code was - if(is_file($path.’/’.$photo[$i])) { - we changed it to if(is_file(“$path/$photo[$i]”)); { and now it works fine.
you have written a very nice piece of code. have another question and thank you for taking time to answer question on page. I overall don’t know a whole lot of PHP but i can get by. my question is is there a way i can hard link to a image in the middle of the gallery have have it pick of of there?
thanks again for taking time.
Comment by James — August 17, 2007 @ 4:20 pm
If you mean link to a specific image page in the gallery, certainly! Each image has a unique address.
http://www.joedolson.com/photo-gallery.php?a=4
If you mean something else, of course, please clarify…
Comment by Joe Dolson (596 comments.) — August 18, 2007 @ 1:07 pm
Hi Joe,
Thank you! This is exactly what I’m looking for. I’m a PHP novice, so forgive a question, which may seem self-evident. I have roughly forty images that I would like to present in two pages. Can you suggest mods to support multiple pages?
Many thanks, — Scott
Comment by Scott (3 comments.) — November 10, 2007 @ 9:52 pm
Hi Joe,
Thanks for what seems like a very simple yet elegant solution. It was up and running in no time flat, and the thumbnails worked as soon as I figured out the need to remove the spaces around the pipe symbol. I am a PHP novice, so please forgive what may be a self-evident question. I have 40 images that I would like to show in two or more pages. Is there a straightforward method for doing that?
Appreciatively, — Scott
Comment by Scott (3 comments.) — November 10, 2007 @ 10:08 pm
Well, the very simplest option would be to simply set up multiple galleries and link them manually. One of these days I’ll modify it for multiple galleries, but it’s not something I’ve seen any need for. Usually, I’ll just set up two or more separate gallery pages. All of the configuration happens within the gallery, so you can continue to use the same main gallery script, just reference a different image folder, gallery name, etc.
Glad you appreciate it!
Comment by Joe Dolson (596 comments.) — November 11, 2007 @ 1:25 am
Well, it seems I’m developing a track record for repeated posts. Please feel free to delete the prior. I meant to write: the redesigned site is at http://www.madisoncamaguey.org — Scott
Comment by Scott (3 comments.) — December 2, 2007 @ 10:59 pm
No problem!
Nice job implementing the script!
Comment by Joe Dolson (596 comments.) — December 2, 2007 @ 11:27 pm
Not sure if you’re still interested in this script, but there appears to be a small mistake in the gallery include. When the last picture in the list is being viewed, the bug causes the “previous” link to link to the page being viewed (the last picture). It’s written as:
case $suma:
$prev = ($suma);
$next = 0;
break;
It should be
($suma - 1). You can see the problem on your example page.Comment by Aaron (1 comments.) — February 4, 2008 @ 10:55 am
Thanks, Aaron - I’ve fixed the sample gallery, and will replace the downloadable files very soon.
I appreciate that — - never noticed that bug!
Comment by Joe Dolson (596 comments.) — February 4, 2008 @ 12:35 pm
I was getting the following Error:
Notice: Undefined offset: 5 in C:\Program Files\Apache Group\Apache2\htdocs\gallery\includes\gallery.php on line 95
I noticed on line 94, in the for loop you have
for($i = 0; $i <= $result; $i++)
to resolve this issue you either have to remove the =, or use $result - 1
if you have 5 pictures the loop is running 6 times, when we only want it to run 5… hope this helps
Comment by WeaponX — March 12, 2008 @ 12:41 pm
Thanks, ah… “WeaponX” — - I’ll get that fixed shortly.
Comment by Joe Dolson (596 comments.) — March 12, 2008 @ 8:46 pm
Hi Joe
To a PHP novice (learning from David Power’s books), I find your wee script relatively easy to understand. I’ve broken it up, thrown it across different CSS layouts, played with the thumb lists (I was/am a Lego kid-says it all maybe) I’m having some fun with it. It’s a nice script Joe.
I have a couple of tips, if I may be so bold.
I noticed that in IE (7 at least), the thumb alts (all but the last one) adds a line break (t’was driving me nuts
. In the titles.txt file, if one adds a Pipe after each line, it goes.
And for the aligned-markup purists, on line 98 of gallery.php (the thumbs list), by adding
\nimmediately after thetag, the markup/source for the thumb list straightens up nicely too.Small as these ‘tips’ may be, I hope it’s of help to thy fellow novices. Again, nice script.
Best regards
Comment by Bob — March 28, 2008 @ 6:07 am
Thanks for your comments and compliments, Bob! I appreciate them. Removing the line break in the
altattribute would certainly be worthwhile - I’m not sure that’s the choice I’ll make for fixing it, but the comment is well and duly noted.I’ll confess that I may not have put as much attention as I could into the formatting of the code output - but your comments are welcome!
Comment by Joe Dolson (596 comments.) — March 28, 2008 @ 10:50 am
Hi Joe
I am just learning PHP & mysql at the moment and came across your great script.
It does seem by far the most straightforward I have found.
I would like to use it to help me learn PHP and adapt it to use on my own site eventually. To this end, the finished script would therefore be used commercially by my small business - what arrangement do you have for this?
The designs I am working on would not allow an obvious acknowledgement to you as I am offering web design design services.
Thanks in advance for your response.
Best regards
Ian Lain
Comment by Ian (1 comments.) — April 16, 2008 @ 4:04 am
Go ahead and do as you will — - I’m not really all that concerned about the licensing terms. I’d appreciate a link in some way; but I’m not going to insist on it.
Comment by Joe Dolson (596 comments.) — April 16, 2008 @ 9:32 am
Thanks for the script! Very Handy!
Comment by David (1 comments.) — May 2, 2008 @ 3:35 pm
I like the looks of the script, but am having trouble using it. I placed the script within my page, and can’t seem to access any of the images in the images folder, though I believe I have the path name correct. I am very new to PHP, so any help is appreciated thanks
Comment by Isaac — August 29, 2008 @ 9:42 pm
It’s hard to say what might be wrong without a bit more information. The most likely candidate, of course, is that the path is actually incorrect — but I hesitate to make any diagnosis with so little information!
Comment by Joe Dolson (596 comments.) — August 30, 2008 @ 10:44 am
thanks for the reply. the path in which my images are in is a folder named “images”, and I have set the path to: “./images” I am able to access other pictures from this folder. Does the gallery require gd library? I know one of the galleries I tried would not work because of this. Anyhow, thanks again for the reply.
Comment by Isaac — August 30, 2008 @ 1:17 pm
Sorry, i should be more clear, i am able to access pictures with other parts of the site, simply using alink just not when using your PHP script
Comment by Isaac — August 30, 2008 @ 1:19 pm
nevermind, i switched my hosting account from windows to linux and the script works great, thanks alot
Comment by Isaac — August 30, 2008 @ 9:38 pm
Sorry I was so late in responding here! Yeah, Windows uses a different file system, and I haven’t really worked on the script to make it usable on both servers. It’s on the list of things to do, but…just hasn’t happened yet.
Glad you were able to solve your problem!
Comment by Joe Dolson (596 comments.) — August 31, 2008 @ 9:51 am
Hi!
Accidently came across your website while searching for implementing a photogallery for my assignment. But unfortunately being a complete novice, I couldn’t get exact details about implementing the photo gallery. I want to do something like Scott has done. Please guide me.
Grateful Manjusha
Comment by Manjusha — October 20, 2008 @ 1:23 pm
Well, I’m not really sure what to say, Manjusha. Do you have a more specific problem to address? The script, while not totally self-explanatory, does contain a fair number of comments to help guide you through the process.
I guess I’m not really clear what you’re looking for!
Comment by Joe Dolson (596 comments.) — October 20, 2008 @ 4:57 pm
Hi!
Thank you for your reply! I am looking for the instructions to incorporate your script to implement the photo gallery and I am stuck because I don’t know how to call your script in my HTML file where I want to display the photos.
Would be grateful if you can instruct me on how to implement your script.
Thank you so much! Manjusha
Comment by Manjusha — October 20, 2008 @ 11:34 pm
Hi Joe!
Finally figured out how to use your script and even make modifications such as color scheme, font etc. However when I added a new photo to the titles.txt file list, it didn’t display at all. Why? While I was testing with the existing photos the gallery worked fine. How do I add a new photo? Since all the photos are listed in a .txt file I thought adding new photos should not be a problem. But I guess I was wrong. Since PHP means Hypertext Preprocessor, how do I resolve this problem of arrays of photos? Please help since I am a complete novice.
Thank you for your help in advance. Manjusha
Comment by Manjusha — October 22, 2008 @ 3:31 am
Hi Joe!
Please ignore my earlier message! I found out what went wrong! Sorry to bother you!
But now I have another question to ask. I have removed the Title, description part in your script (set to blanks). After that the thumbnail images shifted from left to the bottom of the screen. I want to keep the thumbnails to the left and enlarged image to the right with the caption of the photos below the enlarged image. While I could get to see the differences in the thumbnail sizes, font color, background color etc. I couldn’t get the thumbnails to stay put on the left and the enlarged image on the right. Please help me with that. It would be greatly appreciated.
Thank you! Manjusha
Comment by Manjusha — October 22, 2008 @ 3:39 am
Glad you’re figuring things out, Manjusha! Ultimately, it’s the best way to learn. I’m not entirely clear what you did by removing the title and description part of the script; and removing those elements really shouldn’t have any effect on the position of the thumbnails.
The thumbnails are moved to the left using the styles set in
basic_styles.css. The important lines are lines 20-22 and lines 38-48 (in the original script), so if you’ve modified any of those it would make a difference. Hard to guess what’s happened without actually seeing the changes you’ve made, however!Comment by Joe Dolson (596 comments.) — October 22, 2008 @ 9:09 am
Hi Joe!
Thank you so much for your input! I have a funny question to ask. I was able to see the changes I tried out in any of the PHPs but suddenly I am not seeing the photos on the web page at all. The error when clicked on the yellow warning icon on the left bottom corner of the screen shows something like below:
Line: 124
Char: 3
Error: ‘null’ is null or not an object
Code: 0
url: http://www.kalyanibondre.com/index_photo.php
I would be very grateful if you could visit the webpage by typing http://www.kalyanibondre.com and let me know what you think. The modified basic_styles CSS is as follows:
#wrap {width: 0em; text-align: center; margin: 0 auto;}
#thumbs {
width: 180px;
}
img {
border: 1px solid #660000;
padding: 1px;
}
#full_image {
float: right;
width: 500px;
border: 1px solid #660000;
}
#gallery_nav {
float: right;
margin-top: 0em;
border: 0px solid #ffffcc;
padding: 0em;
background: #ffffcc;
}
Since I have a CSS written for my webpage I have tried modifying your CSS as above to keep up with the style on rest of the pages of the website.
Please suggest what could be wrong. Why am I not able to see the results? Please let me know if I can send you your modified gallery.php as an attachment.
Looking forward to your reply.
Grateful Manjusha
Comment by Manjusha — October 23, 2008 @ 9:08 am
Hi Joe!
Finally things worked out the way I wanted!!! THANK YOU SO MUCH FOR YOUR HELP AND A GREAT SCRIPT!! Please check out my handi-work by clicking on the following link:
http://www.kalyanibondre.com/index_photo.php
THANK YOU ONCE AGAIN! MANJUSHA
Comment by Manjusha — October 25, 2008 @ 3:45 am
Hey Joe, thanks for this great piece of code its exactly what I was looking for.
It took some work intigrating it into my PHP site, but it could also be that I went about it the hardest possible way since I have no actuall experiance with PHP code. I can however read and edit it.
as you can see from My test page. I think it time it took was worth it.
I ended up only using 3 parts of your basic CSS file in my theme’s exsiting CSS file, but recoded 2 of them. IE;
#thumbs {
width: 180px;
}
ul.thumbs {
display: inline;
margin: 0;
padding: 0;
}
li.thumbs {display: inline;}
IM not sure which inline caused the thumbs to tile horizonaly, it was lots of guess and check (I said i have little - no experiance right?)
Now that I have it intigrated I’ll make use of the gallery links and just reuse the code for each section of the gallery.
Again, thanks alot for the code!
Comment by RJ Korvemaker (1 comments.) — October 30, 2008 @ 7:44 am
Thanks, RJ! Glad it worked out for you! It’s not uncommon to need to add multiple inline declarations in CSS to get something to work right - the right combination of inline and block elements can be a bit tricky.
The test page looks like it works pretty well!
Comment by Joe Dolson (596 comments.) — October 30, 2008 @ 10:19 am
Hi! Great scripts. I still seem to have the index problem if the number of pictures is not an even multiple of 4. A previous poster commented on this. Is this something I am doing wrong? I have not touched anything, just dropped all the files in my test website and changed the “images” directory path to point to your sample images. Thanks!
Comment by Paul (2 comments.) — December 11, 2008 @ 12:00 pm
Can you explain what you mean by ‘the index problem?’ I reviewed the previous comments, but I’m just not entirely clear what you mean.
One common issue is if there are extra blank lines in the
.txtfile - this will cause extra image spaces to be generated, which can cause problems.I’m glad to help, but I’m just not certain what the problem is!
Comment by Joe Dolson (596 comments.) — December 11, 2008 @ 1:09 pm
I don’t know if I can include a screen shot on here. When scrolling to the second page, I get two thumbnails, and then where the next thumbnails should be, I see:
Notice: Undefined offset:6 in /user/sites/gallerytest/includes/gallery.php on line 116
and then the same error repeats where the only difference is the offset is 7 instead of 6.
Hope that explains it. The site is not public, so I cant demo it. Perhaps it is a PHP version issue? I am testing this on a Mac, not Linux.
Thanks! Paul
Comment by Paul (2 comments.) — December 11, 2008 @ 6:04 pm
Got it. It really relates to your error reporting settings (which are set to show E_NOTICE level errors), but it’s a good thing to fix, anyhow.
If you add this code before the for loop which is throwing the error (line 114, in my copy):
if ($finish > ($result - 1)) { $finish = $result - 1; }That’ll solve the problem. There’ll be a new version for download shortly.
Comment by Joe Dolson (596 comments.) — December 11, 2008 @ 6:22 pm
On line 35:
$current_page = (($a+1)%$num_per_page) ? intval(($a+1)/$num_per_page)+1 : intval(($a+1)/$num_per_page);
I had to change the variable $a to $newa in order for the photos to cycle through the pages.
This script is really good stuff. Michael
Comment by Michael — December 15, 2008 @ 7:03 pm
Thanks for catching that, Michael!
It’s fixed in the download, now.
Comment by Joe Dolson (596 comments.) — December 16, 2008 @ 2:42 pm
Hello Joe,
I can only second what most previous users said, great script, nicely written and easy to understand and tweak. Since I never really made the transition from table based layout to full CSS, I actually tweaked your code to use a table layout. Silly thing to do you’d say but it makes it so much easier to control the appearance of the gallery for someone not willing to burn hours on CSS hacks.
I am having a last difficulty with the Next, previous link behaviors when getting to the last, first pic of the gallery, but I shall sort that promptly.
Thanks again for this great script
Comment by krongsak (1 comments.) — January 9, 2009 @ 10:07 pm
Thanks Krongsak! I appreciate your comments!
Best, Joe
Comment by Joe Dolson (596 comments.) — January 10, 2009 @ 10:17 am
Hi Joe,
Thanks for putting this out there. I’m putting together a website for my sister’s housepainting business and needed a simple way to display photos for her portfolio and found this via a Google search. I haven’t had time to fully test it out yet, but looked at the demo and skimmed over the code and it looks like it might suit my purposes nicely. If I use it on the site, I’ll give you credit.
I want her to be able to maintain the site on her own, so if I have time I may code an admin page that would allow her to select a photo to upload to her page, enter a title and description and then just hit a submit button that would automatically upload the photo and update the text file. If I get around to doing that, I’d be happy to share the code with you if you’d like to have it to add on to this.
Regards, Ken
Comment by Ken Anderson — January 24, 2009 @ 10:48 am
Thanks, Ken - that would be great. It’s one of those things on my todo list, but since it’s been there for two years now it’s probably not going to happen soon!
Comment by Joe Dolson (596 comments.) — January 24, 2009 @ 10:53 am
I’m a newbie at PHP coding and tried to find the answer through the comments above to no avail…I loaded all files to my server and changed the path to access the images. I can see everything with the exception of the thumbnail images. Should I be adding something to see them? Thanks for a great script!
Comment by Kaidre — February 7, 2009 @ 12:39 pm
Hi Joe! So sorry but I did miss one thread comment and it had to do with using relative vs absolute path. I was using absolute path which caused the problem. Now fixed! Thanks!
I’ve got a question though…what if I didn’t want to use thumbnails images but instead just use text as link to the large image? Could you help me with this or refer me to something that would help me out?
Thanks so much!
Comment by Kaidre — February 8, 2009 @ 1:08 am
Glad you figured out the problem! Using text instead of images wouldn’t be a major revision; simply edit line 123 to replace:
with:
Just be sure to provide an
altattribute text in your.txtsource file!Comment by Joe Dolson (596 comments.) — February 8, 2009 @ 10:08 am
Hmmm…I’m confused (*so sorry*)
This is the line I’m finding: (line 123)
echo “\n<a href=’?a=$i’ rel=”nofollow”></a>”;
and I’m not sure what to modify? Do you mean that I need to remove this tag: <img src=’$path/$photo[$i]’
and put in rel=”nofollow”?
Comment by Kaidre — February 8, 2009 @ 11:53 am
I’m sorry! I made things rather confusing by copying the same code for both statements above…I’ve edited the code to be correct — you need to remove the
imgelement and replace it with just thealtattribute text.Comment by Joe Dolson (596 comments.) — February 8, 2009 @ 11:58 am
Sorry Joe but the line didn’t show up in the last thread…here is what shows in my document:
“echo “\n”;”
Comment by Kaidre — February 8, 2009 @ 12:00 pm
Oh gee…I don’t know how to show it! Can I email it to you??
Comment by Kaidre — February 8, 2009 @ 12:01 pm
hello Joe
Thank you so much for this gallery.
I’ve been looking around the web for a long time to find a simple gallery that uses text files for description, paginations etc…
I could install the gallery easily and it work great!
It is very generous of you to share your codes with the world (reminds me of the movie “Hackers”
Anyhow i was just wondering if you would be kind enough to help me get rid of the big image altogether?
I just want the thumnails that link directly to the bigger version of the image (in a new window or whatever)
Thank you so much once again; even if you don’t help me with my question, you are still AWESOME!
Comment by Patrice — February 26, 2009 @ 9:45 am
ps: here is my problem.
this work (link directly to the thumbnail image as a test)
echo "\n<a href='$path/$photo[$i]' rel="nofollow"></a>";this doesn’t work (attempt to link at the bigger image)
echo "\n<a href='$path/$image' rel="nofollow"></a>";I’ve tried many combinations (like $path/$image $path/[$i] )…
all kind of different combinations but i guess i’m just on the wrong track here.
Please help me out if you can. thanks!!!
Comment by Patrice — February 26, 2009 @ 12:53 pm
I’m guessing that the problem is that you’re not actually seeing a link? With no link text or image, these links won’t be visible - they link should work with what you’ve written, but you’ll have some difficulty seeing it.
In the second string, you’ll be needing to add the array indicator as well: $image[$i].
Hope that helps! I’m not sure this is the problem you’re actually having, but it’s certainly a possibility, looking at the code you’ve supplied.
Comment by Joe Dolson (596 comments.) — February 26, 2009 @ 1:29 pm
the
$image[$i]
results in this link
http://www.mysite.com/images/Array
if i use the
$photo[$i]
as a test; it gives me the result i’m looking for:
http://www.mysite.com/images/picture.jpg
thanks for the help man, and once again thank you for this great script!
Comment by Patrice — February 26, 2009 @ 1:36 pm
Cool. Glad that’s working for you! I was responding without really looking at the script, so I’m not surprised I picked the wrong variable…
Best, Joe
Comment by Joe Dolson (596 comments.) — February 26, 2009 @ 1:42 pm
no actually i made a mistake in the last post.
the
$image[$i]
results in this link
http://www.mysite.com/images/Array
if i use the
$photo[$i]
as a test; it gives me the result i’m looking for:
http://www.mysite.com/images/picture_tn.jpg
the $photo[$i] become /images/picture_tn.jpg
the $image[$i] become /images/Array
now i need something that will give me /images/picture.jpg (without the _tn)
if it’s too much problem; please don’t worry about it.
I know you wrote this script more than 2 years ago. cheers!
Comment by Patrice — February 26, 2009 @ 2:23 pm
Ah - of course. Yes, the
$imagearray is a multi-dimensional array. The image should be$image[$i][0]. -JoeComment by Joe Dolson (596 comments.) — February 26, 2009 @ 2:33 pm
haha, yes i tried this one before
but it result in a link looking like this.
http://www.mysite.com/images/Array0
similar results if i use
$image[$i][0]
$image[$a][0]
$image[$y][0]
$image[$i]
$image[$a]
$image[$y]
(yes, i know very little PHP so i go with experiment, eliminations, trial and errors… ;)
Comment by Patrice — February 26, 2009 @ 2:51 pm
figured it out.
it was
$path/$display
but thanks for everything!
Comment by Patrice — February 26, 2009 @ 4:50 pm
good script especially for those who dont like to program or mess with stuff like mysql
Comment by Bob — March 10, 2009 @ 11:00 am
script is great got it working on my own site thank you for making it :)
Comment by Bob — March 11, 2009 @ 10:29 pm
Great gallery for personal use. Thank you!
Comment by Antony (1 comments.) — May 7, 2009 @ 9:19 am
Nice program.I will now be able to use it.
Thumbnails are not visible unless 1st letter of image name is lowercase. cheers
Comment by chang-li — May 16, 2009 @ 3:50 pm
I’m really not sure that’s true, chang-li — although it’s definitely the case that the file names are case-sensitive, whether the image name is lowercase or uppercase should make absolutely no difference. I can’t reproduce any error at any rate; and there’s nothing in the script which depends on case other than the normal apache web server requirement that file names be case-matched.
Comment by Joe Dolson (596 comments.) — May 17, 2009 @ 9:48 am
Hi ,
I’m using litehttpd, as used by FreeNAS (in webserver). With your sample images folder everything works (thumbnails). But when I switch to my foto folder, thumbnails are not shown unless in lowercase. Not a big deal, since i resolved to make all names lowercase.
I added some nautilus scripts to help convert(size) & rename images.
Added a custom background wallpaper image and everything is working - peachy!
Thanks for a nice software.
Comment by chang-li — May 18, 2009 @ 9:49 am
Interesting. Might be something about litehttpd which is causing that problem, I guess — it’s not a webserver I’ve tested the script on (or used at all, for that matter!) so it could be a candidate for something like that.
Still, as long as you’ve solved the problem for yourself, I’m not going to worry about it too much. Thanks!
Comment by Joe Dolson (596 comments.) — May 18, 2009 @ 9:58 am
Hi I’m not the best for scripts, but I made this to create a basic titles.txt from jpg-images in a folder labeled images below the index.php.
#
#!/bin/bash
CD images
ls *.jpg | sed ‘s/$/||/g’ > titles.txt #
Comment by chang-li — May 18, 2009 @ 8:54 pm
Hi Joe!
Writing to you after quite some time! Your PHP photo gallery is indeed easy to work with! However, while using it for the first time with the webpage that has drop-down menu items, I found out that the menu items in the drop down list became ‘center’ aligned which I don’t want! I want the menu items to be ‘left’ aligned! Can you please help?
The webpage which has this problem is as follows:
http://www.arbutusccc.org/pg_project6.php
Please help! Rest all worked just the way I wanted! Thank you once again for a great script!
Looking forward to your comments.
Regards, Manjusha
Comment by Manjusha Wadekar — May 23, 2009 @ 8:44 am
Hi Joe!
Let me rephrase my problem:
Where is this ‘center’ alignment of the whole photo gallery located? I tried searching id ‘gallery’ used at the beginning of the gallery.php which isn’t defined there in the CSS basic_styles.css that you have provided. There is a ‘wrap’ class that you have defined in your CSS basic_styles.css which isn’t used anywhere in the PHPs (gallery.php or title.php). Are we supposed to use them? I don’t see the need. ‘wrap’ id has ‘center’ (used for text alignment) but if it isn’t used then why is the whole gallery ‘center’ aligned on the page? Or how is it aligned ‘center’? is ‘wrap’ a default id? A pre-defined id in CSS? Not user-defined? If I get a clue to this then probably the problem with my drop-down menu items which have been centered can be resolved. Also when the number of photos are odd (< num_per_page), the odd photo gets ‘center’ aligned again! That issue will also be resolved. I hate to use unnecessary, complicated classes and ids when simple things work. I am not exactly a novice to CSS but neither am I a pro to realize the problem in the CSS. However, the problem IS in CSS is the only thing I have figured out so far. Correct me if I am wrong. Please guide.
Awaiting your reply and thanking you in advance for all the help.
Regards,
Manjusha Wadekar
Comment by Manjusha Wadekar — May 27, 2009 @ 12:10 pm
I’m sorry I didn’t respond to your first comment - I started to reply, but ended up not having a chance to finish.
At any rate, no - the #wrap styles and div are not necessary. They are in place for positioning on the sample page, but are not required in any way for the script to function. I suspect that simply removing the
div id="wrap"and the associated styles would fix your problem.And, to answer some of your other questions — wrap is used to align the whole of the gallery body in the window. The text areas within the gallery are individually aligned in other ways.
It’s my general assumption that people using the gallery will be applying it in their own unique ways, and will replace the majority of styles with their own.
Comment by Joe Dolson (596 comments.) — May 27, 2009 @ 3:47 pm
Hi Joe!
Thank you so much for the clue! But I checked your downloaded gallery.php and found out that isn’t used anywhere! I did remove @wrap and its associated styles from the basic_styles.css but again the result is the same! There is a statement in gallery.php at the beginning. When I checked basic_styles.css, I did not find it defined there. Then I thought may be I should remove id=’gallery’ from the gallery.php file thinking that now it will not get to use any styles and then I can use my own. Surprise! I still have not got this problem resolved! It is still the same. Any other clue? If I have to define gallery style as left aligned how can I define it? (I am not a pro at CSS as I said before!)
Please help! This problem has been bugging me for some time now!
Anyway, the good thing is that using the same PHP gallery that you wrote I managed to display text in place of thumbnails and thumbnails in place of the larger view and I turned the images into links to display even larger views in seperate windows!! It worked!!!! THANK YOU FOR A GREAT AND REALLY REALLY EASY SCRIPT!!! But the same problem of left-alignment of the drop-down menu persists though! However, there is no mis-alignment of the text that is being displayed in place of the thumbnails! Cool!!
Thank you once again!
Regards,
Manjusha Wadekar
Comment by Manjusha Wadekar — May 27, 2009 @ 10:39 pm
Hi Joe!
MY APOLOGIES TO YOU!
I did not look properly, the is used in the index.php file!! BUT there is which is an orphan (without its matching ) in that file! Initially when I had changed the index.php to accomodate my menu items and had removed the orphan . The index.php simply didn’t work. I wonder why? The index.php worked better when I removed #wrap (one and two s). There are 9 pairs in gallery.php and one pair and one orphan .
My head has started spinning now! I know it is a very small minor fix but I am unable to do it. It is like a great programme that is not working because it doesn’t compile due to a stupid comma! I am unable to locate that comma!
Once again SORRY for not looking at the script properly before writing to you about #wrap. Please accept the apologies!
Thanks in advance for your help.
Regards,
Manjusha Wadekar
Comment by Manjusha Wadekar — May 27, 2009 @ 11:04 pm
Hi Joe!
Just wanted to let you know that the problem with the ‘left’ alignment of the thumbnail photographs is SOLVED! Yes, removing the ‘wrap’ id from the index.php helped it! BUT the the drop-down menu items are still ‘center’ aligned. That problem is not resolved yet. Now the gallery no longer is centrally aligned but the drop-down menu items still are. Why? Any clue will be greatly appreciated!
THANK YOU SO MUCH FOR HELPING!!!
Regards,
Manjusha Wadekar
Comment by Manjusha Wadekar — May 28, 2009 @ 8:24 am
Hi Joe!
Problem with the left alignment of the drop-down menu items solved!!! Now the items appear left aligned as I wanted to keep up with the style on the rest of the webspages!
There is just a minor hitch! The width of the submenu items is 260 ox on all wenpagesm however it it slightly more on these PHP photo galleries. I am trying to figure out the reason behind it! Hopefully that too shall resolve!
You can check my handiwork by clicking on the following link:
http://www.arbutusccc.org/pg_project6.php
I feel so happy!!! THANK YOU ONCE AGAIN for all your help and putting up with my silly queries! I apologise if I have troubled you!
Many thanks once again!
Regards,
Manjusha Wadekar
Comment by Manjusha Wadekar — May 28, 2009 @ 11:21 am
That’s great! Glad you were able to work things out!
Comment by Joe Dolson (596 comments.) — May 30, 2009 @ 12:18 am
#
I want her to be able to maintain the site on her own, so if I have time I may code an admin page that would allow her to select a photo to upload to her page, enter a title and description and then just hit a submit button that would automatically upload the photo and update the text file. If I get around to doing that, I’d be happy to share the code with you if you’d like to have it to add on to this.
Regards, Ken
Comment by Ken Anderson — January 24, 2009 @ 10:48 am
#
Thanks, Ken - that would be great. It’s one of those things on my todo list, but since it’s been there for two years now it’s probably not going to happen soon!
Comment by Joe Dolson (588 comments.) — January 24, 2009 @ 10:53 am
Please help Ken and Joe. Ken did you do the update?. It sounds exactly what I am trying to do…and being almost 70 the mind is not what it used to be.
Did you do the modifications” I would dearly hope that you have and that they could be kindly shared with the less tallented. Yours faithfully, Philip
Comment by Philip Price (1 comments.) — June 15, 2009 @ 2:12 am
Well, I’m not aware of anything that Ken may have done - but this is on my list of things to do in June and July, so it’s possible it’ll get done relatively soon!
Comment by Joe Dolson (596 comments.) — June 15, 2009 @ 5:36 pm