Image Description

edited November 2006 in How do I?
How would I add a custom, yet different, description for every image at the bottom of the photo?

Example: My photo collection is all fire apparatus and need to add a description for every photo with year, make, model, etc...

Is this possible?


  • no, it is not possible right now. only comment an image has is its own filename as a caption/title.
  • thats unfortunate..This is exactly the concept I am looking for on my site with exception of the lack of comments ability and it also does not appear (unless I overlooked it) it has the ability for a user to control where the images are stored..

    Perhaps a later version will support these features (hint, hint lol)
  • yes, there are projects for implementing external libraries, and perhaps image description. i just have to 1) find the time, and 2) figure out how to do it (in sense of how it will appear, where, how to provide it etc.)

    also to be considered is that i don't want to add complexity to the application, so the implementation has to be simple as it all is right now.

    any ideas are welcome.
  • As far as where, in my case, ideal would be below the photo in the popup that occurs. Text would be located in the center of the image with a line between the photo and text. Considering the background color on the window a bold white would be the idea color (in my opinion)

    As far as the time and other issues I cant help with that. If you dont object I can have a friend of mine look at the code and see if between the two of us we can create a mod that would achieve these two items..
  • sure that would help.

    but then the're are collaterals: if i put the text under the image, then the lightbox has to scroll, and that will bring code issues.

    also, and what worries me more: where to store the comments? in a separate file for each image? in a file inside the folder? and: how to relate each comment to the picture? this is all easy once you hook up a database, but with flat files it can be annoying... once you have 1000 pictures, it won't be easy to modify one comment, and comments for a photo could be buried in a 160Kb text file.

    as i told you, there are implications i have to consider.
  • As far as commenting and picture titles is concerned, I think having the ability to not display certain images titles would be beneficial. For example, insert some sort of regular expression string into the configuration file that would keep any image with a title like "img_3883.jpg". Then, if I wanted to change the title on my images they would automatically display again.
  • ok, two things:

    1. how would i know which titles you don't want to display?

    2. have you tried naming the image with just a two-digit number?
  • Does php handle regular expressions? An additional setting like:

    $settings['ignore_title'][] = 'img\_\d\d\d\d\.jpg'

    and then ignore any title that matches that expression.

    I could easily change the picture titles when I shrink them, the only reason I dont want to is that when people ask me for full-resolution copies of a certain image it's super easy to search for "img_1323.jpg".
  • edited December 2006
    that could be too complicated for most of the users (some don't even know what a regular expression is), mostly compared to the alternatives.

    however, it is easily hackable if you know your PHP:

    1. download the latest release (v09a37)
    2. open
    3. on line
    $caption = $filename;to
    $caption = ((strpos("img_")==-1)?"":$filename);
    and substitute "img_" for the string you are looking for inside image names.

    that might do it for now (have not tested it yet, though, let me know).
  • I've made a mod to read a captions.txt file in each gallery and add the caption to the filename. I've tested it locally and will shortly test it on a live site. Stay tuned.
  • that's nice jimw.

    if you want, email me the file and instructions to minishowcase at frwrd, and i'll see if it might be added as a plug-in module
  • I'll do that. It only seems to work for the lightbox and thickbox view options, not the default. Where would I look for that display?
  • edited May 2008
    Hey I'd like to hear if you guys accomplished this at all...

    I'm not well versed at php but I learn as I go... I wanted to make the captions come from an xml file since xml files are rather simple. Here's my suggestion, my code, and my dilemma:

    in the
    file I made some modifications. I wanted to take the var
    and check that against an xml file for the same value (ie: img_32.jpg). A tag in the xml, look below for example, lists the filename and a caption. If the filename tag matches the $filename, then take the value of the caption tag and store it into a new var
    . If the
    doesn't find an exact match, then return with a
    $title='no title'
    ; Now of course this has to loop for each node in the xml (and this is where my problem is), My only problem right now is with the conditional statement inside the for loop. I have it set at a value of 2 because in the xml, there are two entries. However, when the page loads it loads the value of the second entry. If I change the value to 1, then it loads the first entry.

    foreach ($thumbs as $key => $filename) {
    $img = $filename;
    /*//added code to replace img filename with a caption loaded from xml*/
    include 'example.php';
    $xml = new SimpleXMLElement($xmlstr);

    for ($i = 0; $i < 2; $i = $i) {
    if ((string) $xml->image[$i]->filename == $filename) {
    foreach ($xml->image[$i]->title as $title) {
    } else {
    $title = 'no title';
    $caption = $title;
    /*//end of added code*/

    /* Victor: there is more code after this, not shown here for space reasons */

    the xml looks like this:

    <title type="caption">caption for image 1</title>
    <title type="caption">caption for image 2</title>
  • edited May 2008
    thanks member89 for your contribution (i edited your post for enhanced readability)

    to all: please be aware that the suggested solution requires PHP5 and won't work with previous versions of PHP.

    i also have thought of XML solutions, but decided that in order to keep minishowcase rather simple for the uninitiated I would not use any markup solution, as some of the minishowcase audience might find it rather complex or puzzling.
  • you could also try .CSV

    image_filename, image_caption(instead of the useless IMG_1234), image description

    and make your script read the CSV file
    if CSV not found then show the gallery as is now.
Sign In or Register to comment.