It’s an entirely pleasant, rainy day, so I thought it would be a wonderful time to get going with Noel’s PhotoStack. I grabbed the latest version available and uploaded it to the server.
Trying to be as true as to I would actually use a program like this, I didn’t read any of the documentation. Plus there’s a readme file, but it has no extension so opening it means no less than three or four dialogs in Windows XP. A .txt
extension wouldn’t hurt anybody. It gave me a message that the storage directory wasn’t set up properly, which told me that I probably need to edit a configuration file of some sort. So I fire up SSH. A ls -lah
(which I have aliased as ll
) shows a config.php
, which I guess is what I’m looking for.
I fire up the one true editor. There seems to be a little more at the top than necessary and it doesn’t say much, but that’s a personal peeve. The varible names seem logical (some camelCase going on) but the descriptions above each is not always helpful. Mostly it’s just $photosName
. I’ve never used the program before, and the description “The name of your Photos section.” makes sense to me as an English sentence but I don’t quite grok its significance.
Next up is the path information, which could possibly be streamlined. First we have $dirRoot
where PhotoStack seems to want the absolute path to the script. It recommends “$_SERVER[‘DOCUMENT_ROOT’].’/photos’ may work for you.” but even though that makes perfect sense I’ve dealt a lot with this in WordPress. More people have messed up DOCUMENT_ROOTs
than you could ever imagine, there are a few other solutions that may be better. One I’ve had good success with is dirname(__FILE__).
which works like a charm for finding the absolute path of the current directory. realpath() may also be helpful, but we use the first trick in WordPress. The next variable is the URI of where PhotoStack is located, with the instruction “no trailing slash.” This is another pet peeve, but an instruction like this should be avoided at all costs. No trailing slash there, should I have a trailing slash on $dirRoot
? It didn’t say anything. It causes confusion. It’s programatically trivial to detect and remove a trailing slash on this variable, so why even bother the user? Don’t make me think.
There are a lot more configuration options, a lot. It suggests replacing “no” with “yes” or vice versa to change the value. While this is probably more intuitive than boolean values of true or false, I think spelling out “yes” or “no” several times is a little patronizing. I know, impossible to please.
Okay so I’m done with the configuration file, I reload the URI. Still doesn’t work! I’m guessing it’s time to go to the readme, probably the storage directory needs to have permissions set or something. There is no wrapping in the file, which means each paragraph stretches really far and to read it I’ll have to scroll horizontally in my editor. Wrapping at 72 characters would probably not be a bad idea. Fortunately I know a shortcut (ctrl + j) to fix this but that’s just luck. I find out the software is licensed under the Creative Commons Attribution-NoDerivs-NonCommercial license, which I suppose means I can never use this for a paying client and if I want to improve on the code and release the changes without explicit permission from Noel. If Noel fell off a cliff I suppose the code would be locked under the license and development would halt? I don’t know exactly, but that’s what goes through my mind. Generally I’m much more comfortable with more liberal licenses, be it MIT or GPL or Artistic or anything Free. Next it says:
Templates in PhotoStack are not licensed as part of PhotoStack. Therefore, they are not subject to the licensing terms of PhotoStack. I’m placing this decision in the realm of Mr. Allen… If anyone can lend some clarification that would be great.
That doesn’t inspire the greatest confidence, but I’m planning to modify the templates anyway so maybe I should worry. Finally at the end it tells me to chmod 777
the storage directory. Ah, what I needed to know. I have heard some peopl ecomplain about the liberal chmod requirement before, but it’s really only necessary because of the way most web servers are set up to execute PHP, which I suppose could change in the future. It’s no problem to me. I secure things at a much lower level.
I’m already at the command line so it’s a simple matter to modify the directory. No errors but the pictures don’t load. Whoops, I missed setting $webDir
variable, probably because I was planning to talk about it but went off on a tangent. The default value of this is “http://yoursite.com/photos”, and this is splitting hairs but there are several domains expressly for this purpose and an RFC to back them up. It’s a good practice because since yoursite.com
isn’t reserved, it could theorectically be taken by some unsavory character that used its ubiquity in examples in some malicious fashion. You never know.
It loads! However I click on the sample album and there’s something funky going on with the layout. Perhaps it has something to do with the size I set my thumbnails at (150×150, though I would like to just be able to say something like 150 px on its longest side and allow it to keep its proportion, or just 150 px wide all the time. I’m not crazy about every thumbnail being square). What ever it is it will have to wait until tomorrow because it is past my bedtime. Hopefully tomorrow I can start loading this thing up with photos.
“Matthew! How could you possibly be so nitpicky with this poor guy’s project? How would you like that if someone did that to your project?” Actually, I would be thankful and flattered. If I didn’t like Noel and think PhotoStack could be great I wouldn’t be spending time documenting my thoughts on it. Constructive feedback is golden to an open-minded developer.
Re. the size of your thumbnails – in my photo scripts I use PHP to find out the dimensions of the image file in question, then calculate the padding required to make it up to the uniform size (330x200px), and add it in as an inline style.
I end up with each of my images fitting exactly into the thumbnail box. For examples, see here:
http://www.1976design.com/photography/medium.php
HTH – Dunstan
Hey Matt, good comments. Remember, it’s a beta! 😉 I’m very tired as I just got in from a business trip.
The problem with the thumbnails is just based on the templates. It’s purely a CSS deal that’s causing the fudge up.
Also, your thumbnails don’t need to be square. Just adjust it in config.php.
I’ll attack the rest of your questions accordingly. Thanks.