• Resolved elenacuoco

    (@elenacuoco)


    Hi!
    First of all many thanks for this very powerful, well documented and useful plugin!
    I started using it since some days.
    I want to create a gallery, selecting only pictures from media library which were done using a given camera.
    I tried using the meta data already attached, finding the camera values, as found in this support forum, but It didn’t work.
    So I created a custom field, map all the pictures and it worked.
    Here it is the code
    [mla_gallery]
    meta_query=”
    array(
    array(
    ‘key’ => ‘source-camera’,
    ‘value’ => ‘PULP 4G’,
    ‘compare’ => ‘=’
    )
    )”
    meta_key=”source-camera”
    mla_caption=”{+title+}”
    oderby=date
    order=DESC
    post_parent=none
    type=”rectangular”
    mla_alt_shortcode=gallery
    [/mla_gallery]

    My problem is the following: I checked the field
    “Enable custom field mapping when adding new media”
    but when adding new picture, either from wordpress android app or directly using media library on pc, the new custom field is not automatically mapped. I have to run again the procedure of mapping.
    My questions are:
    is it possible having the new custom field mapped automatically in the procedure of uploading?
    Can you help me in writing the above code selecting directly the camera values, without any mapping?
    thanks

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for the kind words and for your question. Thanks as well for posting the source text of your shortcode.

    I have two suggestions regarding your shortcode, which is otherwise fine. First, you coded post_parent=none, which will omit any images that are attached to a post or page. You may get better results with post_parent=all. Second, you coded oderby=date; this should be orderby=date.

    Regarding your mapping issue I’d like to get more information. You wrote ‘ I checked the field “Enable custom field mapping when adding new media”‘ – did you also check the “Enable custom field mapping when updating media metadata” box just below that?

    You wrote “adding new picture, either from wordpress android app or directly using media library on pc“. I haven’t used the WordPress Android app (yet), but I know there are several ways to add media in the PC/browser application. Are you using the Media/Add New (Upload New Media) screen, the Media/Library “grid” mode or the “Add Media” Media Manager Modal (popup) Window? I’d like to reproduce your issue on my test system and want to make sure I am going through the same process you are.

    I will leave this topic unresolved until I hear back from you. Thanks for any additional details you can provide and for your interest in the plugin.

    Thread Starter elenacuoco

    (@elenacuoco)

    Hi David, many thanks for your answer and suggestion.
    I prefer post_parent=none, since I want to show in a page only pictures which I sent with my phone and not inserted in any post.
    I’ll give you further details:

    did you also check the “Enable custom field mapping when updating media metadata” box just below that?

    Yes: both are checked

    Are you using the Media/Add New (Upload New Media) screen, the Media/Library “grid” mode or the “Add Media” Media Manager Modal (popup) Window?

    I’m using Media/Add New standard upload.
    After the uploading I found the metadata, but not the mapped one.
    Is there a way to access directly the camera field?
    Maybe I won’t need to do the mapping…
    Thanks

    Plugin Author David Lingren

    (@dglingren)

    Thanks you for your update with the additional information. I regret that I did not ask this before, but can you tell me the details of the custom field mapping rule you have created? In particular, where does the “camera field” come from?

    Thanks for your patience and any additional details you can provide.

    Thread Starter elenacuoco

    (@elenacuoco)

    Hi,
    maybe it is faster to explain with a snapshot

    https://dl.dropboxusercontent.com/u/6172869/wpmla.png

    The one I used is source-camera, which is linked to the ‘camera’ already present in the image_meta
    Thanks for your help

    Plugin Author David Lingren

    (@dglingren)

    The screen shot was perfect, thanks!

    I was able to reproduce the issue you are having on initial upload. I believe it has something to do with how the image_metadata is created during the upload and I will investigate further.

    In the interim, you can “access directly the camera field” in an [mla_gallery] shortcode by coding {+meta:image_meta.camera+} in a shortcode parameter or as [+meta:image_meta.camera+] in a markup template. If you need to access it in another context, let me know.

    Thanks for your help with this topic and for your patience.

    Thread Starter elenacuoco

    (@elenacuoco)

    Thanks!
    …but this code
    [mla_gallery]
    meta_query=”
    array(
    array(
    ‘key’ => “{+meta:image_meta.camera+}”
    ‘value’ => ‘PULP 4G’,
    ‘compare’ => ‘=’
    )
    )”
    meta_key=” {+meta:image_meta.camera+}”
    mla_caption=”{+title+}”
    oderedby=date
    order=DESC
    post_parent=none
    type=”rectangular”
    mla_alt_shortcode=gallery
    [/mla_gallery]
    doesn’t work for me…How should I write it?
    thanks
    Elena

    Plugin Author David Lingren

    (@dglingren)

    I regret any confusion I may have caused with my last post. The WordPress meta_query is one of the “other contexts” I had in mind.

    WordPress terminology is a bit misleading. The term “metadata” is used in two very different ways: 1) “image/attachment metadata” is stored in a WordPress hidden custom field ( named _wp_attachment_metadata ) and all of the individual values are packed into one array variable. 2) WordPress Custom Fields are also known as “meta-data” according to the Codex article that describes them.

    The meta_query only works with the second type of metadata, Custom Fields. Your approach of mapping the “image/attachment metadata” camera element to your own custom field is the only way I know to make it available in the meta_query context.

    I hope that makes sense. I continue to work on a fix for the issue you have identified.

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20160714 that contains a fix for the issue you identified. The new version will correctly map the “camera” values to your custom field on initial upload as long as the “Enable custom field mapping when updating media metadata” box is checked.

    To get the Development Version, follow the instructions in this earlier topic:

    Shortcode not working in (special) widget

    It would be great if you can install the Development Version and let me know how it works for you. Thanks for your help and for your patience.

    Thread Starter elenacuoco

    (@elenacuoco)

    Thanks! It works now.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news. Thanks as well for bringing the defect to my attention so I could find and fix it, and your help in testing the Development Version. I will mark this topic resolved when the next MLA version goes out.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.32, which contains the fixes required to support your application.

    I am marking this topic resolved, but please update it if you have problems or further questions regarding the metadata processing outlined above. Thanks for your interest in the plugin.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Selecting pictures using metadata’ is closed to new replies.