PDA

View Full Version : Image gallery script tweaked: Now defaults to "thumbs/" subdirectory for thumbnails



dnl2ba
03-13-2005, 10:23 PM
Those ginormous URLs finally got to me. If you don't supply a thumbnail directory, it'll now assume it's a subdirectory "thumbs/" of your image directory. You still have to make your own thumbnails and make sure they have the same filenames as the full-size images.

I should just rewrite it to auto-generate thumbnails and save them to disk so it only has to generate them once. The current script is written poorly, so it's hard to maintain (not broken into discrete modules, too complex, logic and markup output are too tightly intertwined). Since I don't want to require any kind of web login to generate galleries, it'd mean that any malicious soul could generate thumbnails out of your web-accessible pics, but it's not like they'll take up that much space.

dnl2ba
03-13-2005, 10:52 PM
Just adjusted it to make sure ampersands in filenames and paths are escaped as entity references, for full SGML compliance. I'm sure that's an important feature for you guys.

Any requests for the next version?

dnl2ba
03-14-2005, 12:10 AM
Now correctly handles apostrophes in the path or filename. Jebus.

Edit: And I've changed the default style to Bluegray (the one with the Chinese graffiti on the wall).

dnl2ba
04-27-2005, 08:04 AM
Fancy Index link to gallery view

I've updated the "fancy index" script a little. The part you'll be most interested in is that if the current directory has a subdirectory called "thumbs," the fancy index will have a link to the gallery version of the current directory.

Example (http://mostlycloudy.net/%7Ednl2ba/subpages/alalexandry/gallery/)

To take advantage of this feature, copy ~dnl2ba/utility/php/index/index.php to whatever directory where you want this feature. You can automate this from an SSH command line:

find -type d -exec cp /~dnl2ba/utility/php/index/index.php {} \;
...And all directories downstream from your current one (and including your current one) will get index.php copied into them. Be warned that this will overwrite any existing index.php files without asking.

------------------------------------------

If I ever rewrite this, I'll make it so you don't need to copy this into different directories manually, sort of like how you don't need to copy the gallery script anywhere. There are security concerns I have to muddle through, though (e.g. have to make sure hax0rs can't see the contents of whatever directory they want). And now that I know how a web application should be written, I can make it just generally less disgusting to maintain.

I'm kinda divided about making the file list 100% width. It's nice hat the whole file list doesn't keep changing size as you duck through different directories, but it makes it harder to read when the filename is farther from the metadata (file size, etc.).