Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    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:

    $output .= $filename . '<br />';

    with:

    if ($row['caption'] == "") {
    $output .= $filename . '<br />';
    } else {
    $output .= stripslashes ($row['caption']) . '<br />';
    }
    • CommentAuthorjack
    • CommentTimeOct 12th 2005
     
    I did something simular, but added a <div> instead of a <br> for the text:

    $output .= '<div class="thumbtitle">'.$row["caption"].'</div>';

    .thumbtitle {
    display:block;
    clear:both;
    margin-top:2px;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:11px;
    text-align:center;
    }
  2.  
    D'oh! I forgot to add a stripslashes (edited code above).
    • CommentAuthorbzboarder
    • CommentTimeNov 2nd 2005
     
    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.
    • CommentAuthorddejong
    • CommentTimeNov 2nd 2005 edited
     
    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 .= '&hellip;'; // 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.
    • CommentAuthorttyR2
    • CommentTimeNov 23rd 2005
     
    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.
    • CommentAuthorddejong
    • CommentTimeNov 23rd 2005
     
    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.

    Best of luck,
    Derek
    Thankful People: Squillace
    • CommentAuthormortum
    • CommentTimeNov 23rd 2005 edited
     
    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.
    • CommentAuthorddejong
    • CommentTimeNov 23rd 2005
     
    Very eloquent solution, mortum. Might have to switch.

    Regards,
    Derek
    • CommentAuthorttyR2
    • CommentTimeNov 23rd 2005 edited
     
    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
    •  
      CommentAuthormike
    • CommentTimeNov 23rd 2005
     
    Mortum,

    Your Informity Gallery looks really cool, it's so clean and simple (not to mention the actual images!). Try to do that with Coppermine :)
    • CommentAuthorddejong
    • CommentTimeNov 23rd 2005
     
    ttyR2, try using a smaller truncate value in the admin panel for filenames (e.g. 8 or 10). Also, &hellip; is an HTML entity for an ellipsis "...", for those that care.

    Regards,
    Derek
    • CommentAuthorttyR2
    • CommentTimeNov 23rd 2005
     
    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.

    ttyR2
    • CommentAuthorddejong
    • CommentTimeNov 23rd 2005
     
    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.

    Regards,
    Derek
    • CommentAuthormortum
    • CommentTimeNov 25th 2005 edited
     
    Thank you, mike and ddejong.

    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:

    http://plogger.org/forum/comments.php?DiscussionID=236
    • CommentAuthorstarloft
    • CommentTimeNov 25th 2005
     
    mortum, your fix worked great. thanks!

    i'd like to have the description wrap below the image instead of having to truncate it. how can i do that?
    • CommentAuthorttyR2
    • CommentTimeNov 26th 2005
     
    ddejong,

    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.

    ttyR2
    • CommentAuthorddejong
    • CommentTimeNov 26th 2005
     
    ttyR2,

    On line 193 of gallery.php, cut this:

    <td style="text-align: right;">
    <h2 id="picture_caption">';

    $output .= (trim($row["caption"]) != '') ? stripslashes($row["caption"]) : '';

    $output .= '
    </h2>
    </td>

    Add this AFTER line 212:

    <tr><td style="text-align: center;">
    <h2 id="picture_caption">';

    $output .= (trim($row["caption"]) != '') ? stripslashes($row["caption"]) : '';

    $output .= '
    </h2>
    </td></tr>

    I think that should do it, if not, post and I'll take another look.

    Regards,
    Derek
    • CommentAuthoralfonce
    • CommentTimeFeb 18th 2006
     
    Hmm,

    Ive tried method 1 and 2 in this post but cannot get captions to display instead of filenames....

    What may i be doing wrong?

    http://www.ebro-catfishing.com/gallery/index.php?level=album&id=4

    Thanks,

    Alex.
    • CommentAuthorbab
    • CommentTimeMay 30th 2006
     
    Mortum,

    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.

    Thanks
    • CommentAuthorlokimann
    • CommentTimeJul 9th 2006
     
    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!
    • CommentAuthorlokimann
    • CommentTimeJul 10th 2006
     
    Got it, thanks
    • CommentAuthoricon
    • CommentTimeJul 11th 2006
     
    I tried it but I get this error:

    Parse error: parse error, unexpected '<' in ######/gallery.php on line 204

    It seems I didn't include the code on the right spot, can somebody specifically tell me where to put:

    <tr><td style="text-align: center;">
    <h2 id="picture_caption">';

    $output .= (trim($row["caption"]) != '') ? stripslashes($row["caption"]) : '';

    $output .= '
    </h2>
    </td></tr>
    • CommentAuthorckessler
    • CommentTimeJul 14th 2006
     
    I'm a little confused. Can this:

    if ($row['caption'] == "") {
    $output .= $filename . '<br />';
    } else {
    $output .= stripslashes ($row['caption']) . '<br />';
    }

    be added to completely remove the file name, even if I don't have captions? I tried adding it, and nothing happened. How do I fix this?
    • CommentAuthorddejong
    • CommentTimeJul 15th 2006 edited
     
    No, it will only replace if there is a caption ... instead try:
    if (!empty($row['caption'])) {
    $output .= stripslashes ($row['caption']);
    }
    $output .= '&lt;br /&gt;';


    - Derek
    • CommentAuthorckessler
    • CommentTimeJul 15th 2006
     
    Sorry, where do I put that? I tried adding it and got an error.

    Cyndi
    • CommentAuthorinvictus_92
    • CommentTimeApr 19th 2007 edited
     
    OmegaD you win the prize! damn that was easy! lol. Thanks.
    • CommentAuthorwaely
    • CommentTimeApr 21st 2007 edited
     
    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.

    thank you,
    waely
    • CommentAuthorAngellis
    • CommentTimeMay 6th 2007 edited
     
    None of these tricks seem to be working. Not even the simple one from Omega. I don't know what I am doing wrong.

    http://www.ao-perk.net/~angellis/index.php

    I want to completely hide all the filenames (not including the directory names).

    Edit: Hah! I was changing the wrong line.

    Is there an easier way to find a line of code without pressing the down key # of times? A freeware perhaps? I just use WordPad for now.
    • CommentAuthorkrjames
    • CommentTimeMay 6th 2007
     
    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?

    Thanks,
    Kate
    • CommentAuthorkrjames
    • CommentTimeMay 6th 2007
     
    Oh and...um I've noticed a few people have different backgrounds and colors on their galleries...how does one do that?

    Kate
    • CommentAuthorbdusablon
    • CommentTimeJun 13th 2007 edited
     
    Now, how to remove it from the breadcrumbs at the top...

    (EDIT) Found it - around line 744 remove this line: <b>'.$picture_name.'</b>