• Resolved pivot

    (@pivot)


    I have a wordpress site with thousands of png-files containing metadata. I am now trying to map this metadata to the image Caption-field but without success.

    In the “attachment file metadata” section I see the following:

    post_id => 309
    png:IHDR.Width => 1152
    png:IHDR.Height => 640
    png:IHDR.BitDepth => 8
    png:IHDR.ColorTypeRaw => 2
    png:IHDR.CompressionRaw => 0
    png:IHDR.FilterRaw => 0
    png:IHDR.InterlaceRaw => 0
    png:IHDR.ColorType => RGB
    png:IHDR.Compression => Deflate
    png:IHDR.Filter => Adaptive
    png:IHDR.Interlace => Noninterlaced
    png:Dream => Photohelper, photo of a (eager)+ (glassblowing instructor)++, wearing (a crop jumpsuit)+, (going to a photography class)+ at a (gymnastics gym), blue hour, late spring, hard light, khakicolor, highly detailed, sharp focus, 8k [nfixer-271, (nfixernext)0.8, (wer)0.9, illustration, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face, blurry, draft, grainy] -s 125 -S 1445633174 -W 1152 -H 640 -C 7.5 -A k_euler_a # model_id=realismEngine_v10
    png:sd-metadata => {"model": "stable diffusion", "model_id": "realismEngine_v10", "model_hash": "a9fc962a2a655008c30d9b6485279b0cc71cdc8518590e5f6b8a8a6ed6b5ef64", "app_id": "invoke-ai/InvokeAI", "app_version": "2.3.5", "image": {"v_symmetry_time_pct": null, "hires_fix": false, "threshold": 0.0, "perlin": 0.0, "height": 640, "prompt": [{"prompt": "Photohelper, photo of a (eager)+ (glassblowing instructor)++, wearing (a crop jumpsuit)+, (going to a photography class)+ at a (gymnastics gym), blue hour, late spring, hard light, khakicolor, highly detailed, sharp focus, 8k [nfixer-271, (nfixernext)0.8, (wer)0.9, illustration, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face, blurry, draft, grainy]", "weight": 1.0}], "facetool_strength": 0.0, "init_mask": null, "h_symmetry_time_pct": null, "seed": 1445633174, "width": 1152, "facetool": "gfpgan", "steps": 125, "cfg_scale": 7.5, "upscale": null, "postprocessing": null, "sampler": "k_euler_a", "variations": [], "type": "txt2img"}}

    Since MLA can read this metadata I am hoping it is also possible to map it somehow. My goal is to have the specific png:Dream displayed on the attachment-page

    Is this possible?

    Thank you for an outstanding plugin, incredible detailed documentation and overall a very serious and professional approach. Respect.

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

    (@dglingren)

    Thanks for the positive plugin feedback and for your question. The support for PNG metadata was added recently (MLA v3.07) and I regret that I didn’t quite finish the job. I have uploaded a new MLA Development Version that contains some fixes for this feature.

    You wrote “Since MLA can read this metadata I am hoping it is also possible to map it somehow.?” Are you trying to use an MLA IPTC/EXIF or Custom Field mapping rule to get access to the value? If so, give the development version a try.

    The MLA Development Version dated 20230506 that corrects the problem. You can find step-by-step instructions for using the Development Version in this earlier topic:

    PHP Warning on media upload with Polylang

    Once the Development Version is installed you can access png:Dream in an [mla_gallery] shortcode or in a mapping rule. If you need more specific help, post an update and give me more details.

    Thread Starter pivot

    (@pivot)

    You, sir, are a legend. Thank you, that worked great!

    I managed to map various values from the PNG files to its respective custom field (ACF) like this:

    I have done this for “png:Dream”, “png:sd-metadata” and even for “xmp:xmp.Rating” which XnView writes to the PNG files when I rate the image.

    I am sure that I can map all kinds of metadata using this method, and splitting them into various custom fields gives me a lot of possibilities for using those to filter and search the images in the future.

    I have a couple of follow-up questions that are connected to this:

    • Is there some formula or method for processing the metadata further when mapping them to custom fields? For example: Can I “format” template so that it will only take out “model_id” from png:sd-metadata and place it in the referenced custom field?
    • Is it possible to trigger the execution of all rules from CLI, or maybe a php-script? I am using a plugin called “Bulk Media Register” to add new png-files found in /wp-content/uploads (automatically uploaded using sftp) but it seems that this won’t trigger the required wp hooks or functions to also trigger mapping rules in MLA. A solution might be to trigger it through a watchdog, or just by cron, to make sure all new images are mapped.
    • How would I create a [mla_gallery] that look up any image with a png:Dream metadata that contains the word “Photohelper”?

    I have a few more questions that might be better to open new support-threads for, but I can mention them here just in case you see it beneficial to answer them in this thread instead:

    • Is it possible to make [mla_gallery] responsive? Right now I only found a way to set a defined number of columns, so for phone-screens the thumbnails will be too small and for large screens they will be too big.
    • I plan on using Elementor for some of the functionalities available there, like star-rating populated by the number found in a custom field, and possibility to define rules for what fields are displayed where. Is it possible to integrate MLA with Elementor, for example by having MLA populate the images for a dynamic gallery in Elementor?
    • Im assuming this is well outside of the scope of MLA, but when observing your skill-level and willingness to help us users I feel inclined to ask: Is it possible to use MLA to write metadata back to the PNG files?

    Again, thank you for this amazing plugin of yours! It truly is like a magic wand for my rather special user case.

    D

    Plugin Author David Lingren

    (@dglingren)

    Thanks for the generous feedback and for the good news on your progress. Thanks as well for posting the details of your mapping rule. You should consider checking the “Delete NULL Values” box to save some database storage if you have many items without the Dream information.

    You asked “Is there some formula or method for processing the metadata further when mapping them to custom fields?” You can use the “Field-level option/format values” to perform many extraction tasks, including the powerful “Regular Expression Features”. If you have some PHP skills you can make a small custom plugin alond the lines of the “MLA Diffusion Parameters Example” plugin detailed in this earlier topic:

    how to extract from the parameters field

    Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. Type “diffusion” in the text box and click “Search Plugins” to filter the table.

    You asked “Is it possible to trigger the execution of all rules from CLI, or maybe a php-script? I am using a plugin called “Bulk Media Register” to add new png-files…” I had a look at that plugin and it seems to use AJAX to perform its task. You may be able to activate MLA’s mapping by adding a line to your wp-config.php file:

    define( 'MLA_AJAX_EXCEPTIONS', 'bulkmediaregister-ajax-action,bulkmediaregister_message' );

    or

    define( 'MLA_AJAX_EXCEPTIONS', 'always' );

    You can find more information about this feature in the “IPTC & EXIF Processing Options” Documentation section.

    You asked “How would I create a [mla_gallery] that look up any image with a png:Dream metadata that contains the word “Photohelper”?” You should be able to use the “Simple Custom Field Parameters” for this, e.g.,

    [mla_gallery meta_key=dream meta_value=Photohelper meta_compare=LIKE]

    If that doesn’t work you can try a Meta Query as outlined in the “Custom Field Queries, the “meta_query” ” Documentation section.

    You asked “Is it possible to make [mla_gallery] responsive?” You might find this earlier topic helpful:

    Can the gallery be made responsive?

    You asked “Is it possible to integrate MLA with Elementor…” I don’t know much about Elementor or its dynamic galleries. I do know that other MLA users run [mla_gallery] shortcodes in Elementor applicaions.

    You asked “Is it possible to use MLA to write metadata back to the PNG files?” MLA does not have any features that modify the content of files in the Media Library. This is an early and explicit design decision I made and I have no plans to revisit it. Thanks for your understanding.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA v3.09, which contains the PNG metadata fix described in my previous post. I am marking this topic resolved, but please update it if you have any problems with this latest update. Thanks for working with me on this topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘unable to map attachment file metadata such as png:Dream’ is closed to new replies.