Support » Plugin: WordPress Gallery Plugin - NextGEN Gallery » Description of photo = filename

  • Quick question, is there a way to automatically put the description of a photo to be the FILE NAME? Or perhaps, if theres no description, show the file name or date in which photo was taken?

    Thanks!!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support gabyimagely

    (@gabyimagely)

    Hello @robertboyl,

    Please, check our information on how we control and handled metadata inside your photographs here: https://www.imagely.com/docs/image-meta-data/

    Titles
    If your photo metadata before uploading has a title, then NextGen Gallery will use that. But if there is no meta title then the image’s name is a required field and we are automatically getting it from the image’s filename.

    Subject / Description / Caption
    NextGen Gallery imports the “subject” of your photo or “Caption” into that “Description” field for each photo.

    Tags/Keywords
    Image “tags” are picked up from the “keywords” in the image metadata when uploading/importing.

    We hope that this helps!

    Hi!

    Thanks a lot. Cool! But Id have to add that info in each image.

    I wanted, if possible, a way to automatically setup Nextgen to add the date of the file in the descriptions.

    Thanks

    Friends,

    any ideas?

    Thanks!

    Hi Robert, not a support guy, just another user. The default setup doesn’t have that option to “rename” as it uploads, so my guess is that you will have 3 options with varying levels of difficulty for manual / etc.

    a. You could modify the custom code for the plugin so that it would add the variable to the filename. That’s beyond the program’s base code though, would definitely be customization. You could try asking the sales page of their website to see if the Pro version could be customized to do that (they can’t answer pre-sales question in WP forums).

    b. Use a customized search/replace tool that would edit the filename and the database. This would be, in my view, quite complicated as you would want the tool to edit the filename in a specific file folder AND edit the reference in the database AND calculate what the filename would look like.

    c. A bigger question though would be why you want to do it? If we know why you want to do that, we might have a better solution to get the same result.

    My reaction is more, too, that the filename is hidden, you don’t see it, so why bother? You see the title and the description, but not the filename. You DO see the filename, as Gaby mentioned awhile ago, but only if the original metadata field was blank AND you only see in the sense that if Title is blank, it copies the filename in there. It isn’t the actual filename, it is a copy of it. So, do you need to change the actual filename? Or just the title? Of course, those can be edited manually. However, the “proper” solution to edit the filename is to do so BEFORE you upload it. If you’re modifying the filename, why wouldn’t you modify it before you get it on the site, because once it’s on the site, it’s 10x harder to manipulate it…I assume the answer is that you have a lot on the site already, and you want to now modify the existing ones, as opposed to having to reupload them. But the easiest solution is probably to go through and edit manually for the ones you have but fix your naming convention before you upload — lots of apps will let you rename easily, including pulling data from meta information (like dates).

    Again though, if we know more about what you are trying to do, we might have better solutions … changing the filename is not going to be a quick config solution.

    Very nice of you, Pollywogg.

    Let me explain. I have a bunch of photos I upload and Im a bit tired of having to add a description for each one.

    I wanted to upload 5 photos, for example, in a category and make system automatically add the description with the date of the photo… So I dont have to type manually that info.

    So I took 2 photos on dec. 10th…

    I upload them a few days later, automatically, description field for these photos would show “dec. 10th”.

    Possible?

    I tried to go over settings, didnt find a way. Will try to analyse manual a bit…

    Thanks! Happy 2021!

    PolyWogg

    (@polywogg)

    Thanks Robert for clarification…so it isn’t exactly the filename you want to change, it’s the secondary meta data. The short answer is that neither base version nor the Plus version that I use has a built in option to do that.

    However, I’m really intrigued by the question, as a fellow user who found a different way to do it while looking at some of the meta data. I’m far from an advanced photographer, but because I’m a bit anal about filenaming, structures, etc., I’ve looked at hours and hours of reading material on blogs and elsewhere from pros who have VERY strong opinions about filenames, folder structures, workflows, and meta data. Some of it is really hard-core, but it gave me some ideas for my own stuff.

    As such, I *think* you have four options depending on your workflow…

    a. When you take the photo – change filename and/or metadata

    In my Canon DSLR, and some smartphones, I can change the way the filename is created. So it could be PIC002745 – Dec 10 if I want it to be. This would give you the filename from the start for it to autofill later.

    Some of the cameras and phones will also let you autofill meta data fields.

    For reference, in meta data, NGG seems to use three types:

    – for regular meta data, “title” goes into NGG’s “title” and “caption” goes into NGG’s “description”;
    – in EXIF, it doesn’t do NGG’s “title” as the one called “title” goes into NGG’s “description” field;
    – in IPTC, “title” goes into NGG’s “title” field and “caption” goes into NGG’s “description” field.

    If your imaging device lets you prepopulate those fields at the time of capture, you could put the date in whichever you want to use and they would auto upload to the right fields. Some people in the photography fields are religious in making sure the data is there when it is first captured as it saves a TON of time later if a filename changes or a date gets updated, those fields stay static once created. It’s a way some photographers “lock” in their data at the get-go.

    I don’t use this option as my future metadata is more prose description than a date and, as you’ll see below, I pull from a bunch of different data sources with different formatting options for filenames and meta data.

    b. When you transfer the photo to PC – change filename and/or metadata

    Depending on how you transfer your photos to your PC, assuming you do, there are lots of programs like PhotoShop, LightRoom, etc., that will let you set a WHOLE BUNCH of auto data on import when you do. The default is just to copy of course, but if you open the features, it will often let you decide what the filename should look like (i.e., PIC0256 – DEC 10th or DEC 10) as well as autofilling metadata (like the normal tags, EXIF and IPTC data mentioned above — usually it likes to use one of the three more than all three).

    c. On the PC before you upload – change filenmae and/or metadata

    This is the option I took, and I’ll explain my context as it drove my choice.

    I don’t like paying for a subscription-based file manager, and I REALLY don’t like the bloat that comes with Adobe products. As such, I tried out a whack of different software, and I ended up going with one called Mylio that I really like. However, almost all of the software is amenable to whatever workflow you choose, often coming down to a) import, b) sorting, c) processing (if any) and d) future uploading (either direct or indirect).

    For me, I have seven different sources of images coming in … my DSLR, my wife’s point and shoot, iPhones x 3 for members of my family, a webcam, and a variety of “created” pics. I get them in rough order using a basic file manager and then import them into Mylio, which will manipulate just about any format I get. Once in Mylio, I sort my photos, choose the best images, etc. Ones that I’m “sharing” to WP, I move into a “good” folder, and the rest go into an “extras” folders. Then I run through the good ones, see if there are any I want to adjust colours for (basic manipulation directly in Mylio). If there are, I duplicate the picture, move the original to the Extras folder and edit the copy.

    The part that is relevant to you though is that in Mylio, I can now set all my metadata, including even renaming the filename if I want although there is no reason to, as the title and caption map to the various metatags on upload. I tend to make my title and description the same in NGG as different templates pull from different places, and I always want my displayed caption to be the same. Soooo, I just manually enter what I want — in my case, I use prose. However, Mylio lets me select multiple files at once and edit the metadata in one fell swoop. For me, I might do “Dec 10 – Visit to the cottage” and if there are 10 photos, they all get the same title/description applied, and will appear as such when I upload to NGG. Occasionally, I forget and when it gets in NGG, the meta data is blank. I *could* edit once there, but I find it easier to just delete them, edit in Mylio, and then reupload.

    As an aside, Mylio doesn’t have any built in feature to auto-upload to NGG (I wish it did — it has the capabilities for someone with coding expertise to try coming up with one as it WILL upload direct to Flickr and Google Photos, or at least it used to). Instead, I right-click the final set of folders, it lets me “SEE IN EXPLORER”, it opens the folder for me, and I just drag and drop the images to a new gallery in NGG. Everything uploads easily, everything gets mapped the way I want, and all my captions and stuff are done.

    FYI, doing it in any of the steps above ALSO means that if for some reason your site crashes, and you lose data or files, or have to reupload stuff, you won’t have to recreate all the metadata. It’s already saved.

    Some people also take this opportunity to optimize the image before uploading to be more website-friendly for loading, but I don’t bother.

    d. After uploading to WP – change filename and/or metadata

    Last but not least, there are the separate coding options mentioned above. As I said, I read tons of pros tips and tricks, and they all came to the conclusion that is better to do everything they can BEFORE it is uploaded than after. Doesn’t mean it is the right solution for everyone, but after going down the rabbit hole for my stuff, I ultimately came to the same conclusion for me too.

    As an aside, mine is also reinforced by the fact that I do astrophotography too through my telescope. Which means I have to do a ton of manipulation of data files before I even give it to Mylio, and so there are pros out there who end up with multiple folders:

    a. Raw files
    b. Initial sorting of raw files for target and quality
    c. Initial alignment of raw files (centreing)
    d. Stacking of processed file
    e. Basic processing (light balance, etc.)
    f. Post processing (wavelets)
    g. Advanced processing (layers)
    h. Processed images
    i. Final converted images
    j. Imported images for upload

    Most will edit the initial meta data at (a) but once they do their processing, all of that is lost, so they apply it again at (h) or (i).

    Likely overkill, it is for me, I only do a few of those folders, just giving you an overview of all of it at once, if you see anything in there that sparks a solution for you…of course if you develop a quick tool that will let you apply meta data easily afterwards in some sort of auto-fashion, I’m happy to steal from you. 🙂

    Paul
    aka PolyWogg

    Friend!

    Very nice of you! What a nice email with so much info!! Ive just been so busy, I need time to assess all this.

    How can renaming or adding info to file help?

    All I wanted was to upload a bunch of photos to my gallery and not have to manually add description for each photo… As it’s tiring. Is there some way, if file has the info inside it, to tell Nextgen to “fetch it” and automatically add that to the description?

    For example, see this gallery

    https://www.imagely.com/wordpress-gallery-plugin/pro-mosaic-gallery/

    Notice none of the photos have descriptions? I wanted a way to automatically add description = date the photo was taken, this way its more or less organized, cronological, showing what time the photo was taken, etc.

    Id even be willing to buy the pro version, if needed. In terms of programming, unfortunately not my thing.

    Thanks so much!

    Plugin Support Benjamin

    (@benjaminowens)

    Quick question, is there a way to automatically put the description of a photo to be the FILE NAME? Or perhaps, if theres no description, show the file name or date in which photo was taken?

    The following will run every time an image is added to NextGEN Gallery and if there is no description will replace it with “January 6, 2021”:

    add_action('ngg_added_new_image', function($image) {
        if (empty($image->description))
        {
            $mapper = C_Image_Mapper::get_instance();
            $date = new \DateTime($image->imagedate);
            $image->description = $date->format('F j, Y');
            $mapper->save($image);
        }
    });

    You can find a list of formatting codes on the php.net documentation for DateTime.

    Thanks again @polywogg for all your work here!

    Thats cool. Where do you add that code? Now I have ideas for my own site heheheh

    PolyWogg

    Plugin Support Benjamin

    (@benjaminowens)

    I like to place site tweaks and adjustments in their own plugin specific to that site.

    Create a file named “exampleDotOrgTweaks.php” and place it in wp-content/plugins/:

    <?php
    /*
     * Plugin Name: example.org Site Tweaks
     * Description: Custom modifications for example.org
     * Version: 0.1
     * Plugin URI: https://example.org/
     * Author: Your Name Here
     * Author URI: https://example.org/
     */
    
    add_action('ngg_added_new_image', function($image) {
        if (empty($image->description))
        {
            $mapper = C_Image_Mapper::get_instance();
            $date = new \DateTime($image->imagedate);
            $image->description = $date->format('F j, Y');
            $mapper->save($image);
        }
    });

    I hope that helps!

    Cool, I’ll file this one away for future use 🙂

    P.

    Hi, Benjamin

    Wow! Thanks a lot! Sorry, but I guess Im a weak Nextgen user. So all I have to do is add this code you sent in plugins folder, after I upload an image it will put that day’s date on the description? Any way to get the data of the photo itself?

    I might take a photo, upload it a week later, ideally, I wanted the date of the photo, however, your method already helps a lot.

    Couldnt Nextgen/Imagely have a feature to have templates in description and use variables, like date/time photo was taken?

    Sorry for being too demanding.

    Thanks.

    Plugin Support Benjamin

    (@benjaminowens)

    All you have to do is place that file in your /wp-content/ and activate it on the Plugins page.

    The photo data is stored in the $image variable, it will look something like this:

    stdClass Object
    (
        [pid] => 44
        [image_slug] => 00067201
        [galleryid] => 2
        [filename] => 00067201.jpg
        [description] => Dido and Aeneas; Nicolas Verkolye (Dutch, 1673 - 1746); The Netherlands; early 18th century; Oil on canvas; 90.2 × 117.5 cm (35 1/2 × 46 1/4 in.); 71.PA.66
        [alttext] => Dido and Aeneas
        [imagedate] => 2021-01-19 20:48:26
        [exclude] => 0
        [sortorder] => 0
        [meta_data] => Array
            (
                [aperture] => 
                [credit] => 
                [camera] => 
                [caption] => Dido and Aeneas; Nicolas Verkolye (Dutch, 1673 - 1746); The Netherlands; early 18th century; Oil on canvas; 90.2 × 117.5 cm (35 1/2 × 46 1/4 in.); 71.PA.66
                [created_timestamp] => 
                [copyright] => 
                [focal_length] => 
                [iso] => 
                [shutter_speed] => 
                [flash] => 
                [title] => Dido and Aeneas
                [keywords] => 
                [width] => 1024
                [height] => 787
                [saved] => 1
                [backup] => Array
                    (
                        [filename] => 00067201.jpg
                        [width] => 1024
                        [height] => 787
                        [generated] => 0.30013000 1611089306
                    )
    
                [md5] => 87ce08db7fdf6a81534a7dfc42af55a8
                [full] => Array
                    (
                        [width] => 1024
                        [height] => 787
                        [md5] => 87ce08db7fdf6a81534a7dfc42af55a8
                    )
    
                [thumbnail] => Array
                    (
                        [width] => 240
                        [height] => 160
                        [filename] => thumbs_00067201.jpg
                        [generated] => 0.58162500 1611089306
                    )
    
                [ngg0dyn-480x320x100-00f0w010c011r110f110r010t010] => Array
                    (
                        [width] => 480
                        [height] => 320
                        [filename] => 00067201.jpg-nggid0244-ngg0dyn-480x320x100-00f0w010c011r110f110r010t010.jpg
                        [generated] => 0.74623700 1611089306
                    )
    
            )
        [updated_at] => 1611089306
    )

    As long as your camera includes the date in the photo metadata (and they all do by default I believe) the code I gave will use the date the photo was taken. To use the date of upload just remove the parameter given to “\new DateTime()`

    You’re not demanding at all! It’s great for us to see how our users actually use our software and how we can improve it 🙂 I’ve submitted your idea of templating image descriptions to our feature wishlist, thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.