I just recently started playing with Plogger, lovely piece of code and very simple. I love that it's all based around CSS and I can do so much without delving into the PHP.
However, I just wanted to let others know how to remove the filenames from the thumbnails. This little modification will use the caption, if it's present or default back to the filename. Just thought it helped to make it look more beautiful.
In Gallery.php, around line 429, replace this line:
I'm not sure if this is possible but this is what I was wondering... I changed my gallery to display the caption instead of the filename, but that caused a problem. Some of my captions are long and cause the thumbnails to be scattered around the page. My question is, is it possible to keep the long caption and just have it display only a portion of the caption if it is too long. For example: if my caption reads "once upon a time, in a land far far away" i would like it to shorten it under the thumbnail such as "once upon a time..." but still have the actual caption the correct length. Is that possible or asking too much. Thanks for any input.
Bzboarder: This is not a definitive fix, and I'm sure somebody (esp. the Plogger folks) could find errors, but this is my submission: $output .= '<span class="thumb-title">'; if (!$row['caption']) { // Dunno if this would cause problems, works on PHP 4.4.0. $output .= $filename; } else { $title = $row['caption']; if (strlen($row['caption']) > 10) { $title = substr($title,0,10); $title .= '…'; // Ellipsis ("...") HTML entity. Replace with three periods if you would rather. } $output .= stripslashes($title); } $output .= '</span>n';
If it doesn't work, reply and I or someone else can help you. It is possible to test for the presence of whitespace and break it there instead (like your "once upon a time..." example), but I find real-world situations don't easily lend themselves to that kind of solution.
HTH, Derek
Edit: By "errors", I meant inefficiencies or potential conflicts. I didn't mean coding mistakes. Don't worry, the code does work.
Is there a way to force comments to wrap so that they don't affect the horizontal spacing of the thumbnails? Obviously the comments would have to be small or it'd look bad, but two or three lines would be okay.
I responded to this question in two other posts. There's one if you want to wrap spaces in the gallery view (breaking them into multiple lines), and another if you want want to truncate and add an ellipsis. Both could be combined, but I prefer the latter because you're liable to break the floated-image gallery with the former.
I can suggest slightly different and, as it seems, simpler solution:
// Override default thubnail file name with optional caption $filename = $filename_short = $row["caption"] ? $row["caption"] : basename($row["path"]);
// Create a substringed version of the $filename if (strlen($filename) > $config["truncate"] && $config["truncate"] != 0) $filename_short = substr($filename, 0, $config["truncate"])."...";
// Enclose that thumbnail text into div with defined class name (just like in jack's case) $output .= '<div title="'.$filename.'" class="thumbnail_text">'.$filename_short.'</div>';
// Add thumbnail_text class to gallery.css for full control (including display) /* Thumbnail text */ .thumbnail_text { color: #AAAAAA; font-size: 0.8em; cursor: default; }
This way the length of that thumbnail text string will still be relying on the original file name truncating mechanism but the user will gain full control over its appearance. Clean and simple :)
Also, since we are on the subject of the gallery.css, check out my version of that: http://www.informity.com/gallery/css/gallery.css - I reorganized it for my gallery http://www.informity.com/gallery/ - with the exception of two-three custom classes, that file should be pretty consistent with the original but perhaps the one easier to work with.
Mortum, when I try your code, the comment and/or file names can still be wider than the thumbnails. Did I do something wrong? I added the following right after line 430 in gallery.php:
// Override default thumbnail file name with optional caption $filename = $filename_short = $row["caption"] ? $row["caption"] : basename($row["path"]);
// Create a substringed version of the $filename if (strlen($filename) > $config["truncate"] && $config["truncate"] != 0) $filename_short = substr($filename, 0, $config["truncate"])."...";
// Enclose that thumbnail text into div with defined class name $output .= '<div title="'.$filename.'" class="thumbnail_text">'.$filename_short.'</div>';
Example at http://pictures.teamgenesisracing.com/index.php?level=album&id=5
ttyR2, try using a smaller truncate value in the admin panel for filenames (e.g. 8 or 10). Also, … is an HTML entity for an ellipsis "...", for those that care.
I played with the truncate value. That's do-able. Though I want to add the full comment to the bottom of the image when you click the thumbnail. What file handles the intermediate view? I should be able to figure out the rest.
gallery.php handles the intermediate view. You shouldn't have to change anything -- the caption should appear in its entirety already, as above Mortum (rightly) never changes the actual caption value.
I have been in RAD (rapid application development) and concept prototyping for quite some time now... and, as I am playing with Plogger (excellent job!) more and more, I naturally coming up with some suggestions. I am sure, there are others who can socially contribute to this project - think of this as an idea pool or a community code repository from which the actual developers can extract and implement the best suggestions and hacks.
I am not sure if what I am suggestion falls into â??Customizing Ploggerâ? category. My title would be something like â??Plogger Hacksâ? or â??Plogger Hacks and Suggestionsâ?. Meanwhile, here is my contribution - "Plogger Hacks" post:
I was specifically looking to move the comment from the upper left to down under the image. Yes, the comment does appear in it's entirety, but it doesn't really catch the eye. I'd imagine a lot of casual visitors would miss it entirely. Not so if it was where comments usually are, under a give picture.
How did you get the Full size picture to stay within your website. I can't seem to figure out how to get the full size image not to open in a plain white window.
Mortum, Thanks for your code. I am looking forward to the functionality. Can you tell me what section of code to replace? I am a newbie and unsure of what I may break. Thanks again!
No, it will only replace if there is a caption ... instead try: if (!empty($row['caption'])) { $output .= stripslashes ($row['caption']); } $output .= '<br />';
hi guys, I can't find the code that you're refering to in the gallery.php to remove my filenames. I upgraded to 3.0 and the filename is already removed.
Ummm I read through this thread but am still a little confused. I'm no coder but I can do basic stuff. I want to get rid of the filename completely...would love to be able to change it, but thats not really necessary. What code would I use to completely remove the filename?