Support » Plugin: Media Library Assistant » Title not extracted for PDF imported using plugin

  • Resolved sjnbham

    (@sjnbham)


    When using the WordPress Media Folder plugin’s Server Import feature to import PDFs, the title isn’t extracted from the PDF metadata. When manually uploading the same PDFs using the Media Library, the title is extracted as expected. Not sure which plugin might need to be tweaked for this to work. But posting here in case there’s a way to update MLA to be triggered when their Server Import feature runs. The feature does create Media Library posts for each PDF imported.

    Thanks for any info you can pass along.

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

    (@dglingren)

    Thanks for this post. I want to make sure I know which plugin you are using, since there are several in the WordPress Repository. I found this likely candidate:

    WordPress Media Library Folders

    Is that the right plugin?

    It’s a premium plugin from JoomUnited: https://www.joomunited.com/wordpress-products/wp-media-folder

    I’m happy to grant admin access to our test site if you’d like to have a look where both plugins are installed.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for giving me a link to the right plugin. I have opened a ticket with JoomUnited to see if I can get a copy of their plugin for my testing, since I cannot afford to purchase premium plugins simply to support my own free plugin. I will post an update here when I have progress to report. Thanks for your understanding and your patience.

    Thanks for being so responsive and looking in to this! If we can get this working, there’ll be a donation headed your way 😉 If we use plugins for business, we always donate annually to help support dev and maintenance.

    This was the response from the developers of the WP Media Folder plugin:

    “This plugin uses the wp_insert_attachment and wp_update_attachment_metadata function to import the files from FTP to the Media library. Maybe Media Library Assistant has a hook to extract PDF metadata. Can you contact their support to see if they might have a solution?

    Plugin Author David Lingren

    (@dglingren)

    The JoomUnited support team quickly responded to my ticket and generously gave me a copy of their plugin for testing purposes. I have installed it on my system and run a few tests.

    I am not sure how to access “WordPress Media Folder plugin’s Server Import feature to import PDFs“, and I don’t know specifically the IPTC/EXIF mapping rule (if any) you are using to extract the title from “the PDF metadata“. Can you give me the steps I must follow to reproduce your issue? Thanks for your help.

    Settings in Media Library Assistant you need to have in place if you’re trying to set this up in your test environment:

    1. Settings > Media Library Assistant > IPTC/EXIF tab
    2. Select “Enable IPTC/EXIF Mapping”; “Enable IPTC/EXIF Mapping when adding new media”
    3. In the right column with the IPTC/EXIF mapping rules, edit the Title entry:

    Name = Title
    EXIF/Template Value = template:([+pdf:Title+]|[+exif:Title+])
    Priority = IPTC
    Existing Text = Replace
    Status = Active

    The process to use WP Media Folders to import a PDF:

    1. Upload a PDF with a title in its metadata title field to a directory on your web server (e.g. /wp-content/docs).
    2. Install and activate WP Media Folders
    3. Go to Settings > WP Media Folders > Server Import
    4. Place a checkmark next to the box where your PDF to import is stored (e.g. /wp-content/docs)
    5. Click the Import Folder button
    6. Check the media library under the folder of the same name you imported (e.g. “docs”) for the PDF

    If the testing goes as expected, the imported PDF won’t have the proper Title value in the post title field. But if you drag and drop that same PDF into the media library upload screen, it received the correct title (PDF file metadata title field value).

    Plugin Author David Lingren

    (@dglingren)

    Thanks for posting the rule settings and the import process. It was everything I needed to reproduce and solve the issue you reported.

    WP Media Folders uses an AJAX request to process the Import From Server task. To minimize memory and processing load, MLA does not load its mapping logic for AJAX requests it does not recognize. In the “IPTC & EXIF Processing Options” section of the Settings/Media Library Assistant Documentation tab you can find the solution:

    Some plugins support file uploads from the WordPress “front end”, usually by using the WordPress “AJAX” support. To enable mapping when these plugins are used you must add an entry to your wp-config.php file so MLA will load the mapping code:

    define( 'MLA_AJAX_EXCEPTIONS', 'wfu_ajax_action,upload_ugc' );

    You can find more information and tips in the Documentation tab, but that’s the basic answer. WP Media Folders uses a “wpmf_import_folder” action for its work, so for your application the entry would be:

    define( 'MLA_AJAX_EXCEPTIONS', 'wpmf_import_folder' );

    Adding this line to the wp-config.php file solves the problem on my system. Please give that a try and let me know if it works for you.

    Thanks as well for your generous policy of supporting plugin authors with your donations. As indicated on my own web site, I no longer accept donations for MLA but I applaud your policy.

    I am marking this topic resolved, but please update it if you have problems or further questions regarding the solution outlined above.

    That makes sense. Thanks for pointing that out in the documentation. I still can’t seem to get this to work though. I’ve tried:

    define('MLA_AJAX_EXCEPTIONS', 'wpmf_import_folder');

    and

    define('MLA_AJAX_EXCEPTIONS', 'always');

    I tried disabling all plugins except WP Media Folders and MLA.

    When I ran the debug for MLA I received the following:

    [02-Aug-2019 22:29:33] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:29:34] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
    ‘dir’ => ‘/’,
    ‘action’ => ‘wpmf_get_folder’,
    ‘wpmf_list_import’ => ”,
    ‘wpmf_nonce’ => ‘c17e5306eb’,
    )
    [02-Aug-2019 22:29:34] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
    ‘action’ => ‘wpmf’,
    ‘task’ => ‘get_exclude_folders’,
    ‘wpmf_nonce’ => ‘c17e5306eb’,
    )
    [02-Aug-2019 22:29:34] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
    ‘dir’ => ‘/’,
    ‘id’ => ‘0’,
    ‘action’ => ‘wpmf’,
    ‘task’ => ‘get_user_media_tree’,
    ‘wpmf_nonce’ => ‘c17e5306eb’,
    )
    [02-Aug-2019 22:29:34] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
    ‘dir’ => ‘/’,
    ‘action’ => ‘wpmf_get_folder’,
    ‘wpmf_nonce’ => ‘c17e5306eb’,
    )
    [02-Aug-2019 22:29:40] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
    ‘action’ => ‘wpmf_import_folder’,
    ‘wpmf_list_import’ => ‘/test8/’,
    ‘wpmf_nonce’ => ‘c17e5306eb’,
    )
    [02-Aug-2019 22:29:44] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:29:49] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:29:49] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:29:49] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:29:52] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:29:56] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
    ‘action’ => ‘wp-remove-post-lock’,
    ‘_wpnonce’ => ’30d3d074e1′,
    ‘post_ID’ => ‘10864’,
    ‘active_post_lock’ => ‘1564784993:3’,
    )
    [02-Aug-2019 22:31:35] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3
    [02-Aug-2019 22:31:38] 600 MLACore::mla_plugins_loaded_action() MLA 2.79 () mla_debug_level 0x3

    Plugin Author David Lingren

    (@dglingren)

    Thanks for trying out the suggestions and for your extra work to activate and share the debug log.

    It would be very helpful if you made a couple of changes and re-ran your tests. First, verify that you’ve deleted all the items in the /test8/ folder before running the Import From Server action. WP Media Folders will not re-run the import process for items already in the Media Library.

    Second, change the MLA Reporting value to “0x3F” before running the tests. That will activate logging for the mapping process and give me a lot more information to investigate.

    Thanks for your patience and persistence.

    sjnbham

    (@sjnbham)

    OK – this is working now. I’m still new to WP and didn’t realize the wp-config.php entry needed to be added before the include statement for wp-settings.php. The JoomUnited support staff pointed that out for me. Again, thanks for such a quick and helpful response on this. I also didn’t realize you weren’t accepting donations until you said something. There’s a donate button on the WP plugin page for MLA, so assumed donations were still possible. But I clicked through to your plugin site and see the note now. Thanks for giving back to the community!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news. I’ll make a note about the placement of the define statement for other MLA users. Good luck with the rest of your application!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Title not extracted for PDF imported using plugin’ is closed to new replies.