• Resolved somecows

    (@somecows)


    I am at the very beginning stage of trying to get this plugin to work. Have not even begun to think about all the options available.

    I am using this plugin because I want to display PDFs, or a list of PDFs, or whatever is possible. I copied this code off of the Documentation tab:

    [mla_gallery post_parent=all post_mime_type=application/pdf]

    It said it would result in a list of all the PDFs in the media library.

    But I get nothing. There are many PDFs uploaded to the media library.

    What am I doing wrong?

    Thank you

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

    (@dglingren)

    Thanks for your remarks and for your question. I appreciate the effort required to get up the MLA learning curve; there’s a lot to explore.

    Regarding your PDF shortcode, I don’t see any obvious errors. I copied it to a page on my own system and (of course) it works for me. The syntax and parameters look fine.

    Assuming you have some images in your Media Library, have you tried the even simpler:

    [mla_gallery post_parent=all]

    Or, you can take the ID value from the Media/Assistant ID/Parent column and try something like this:

    [mla_gallery ids=9999 post_mime_type=all]

    where 9999 is replaced by your PDF’s ID value.

    Finally, you can try displaying and inspecting the extensive (and ugly) debug information that tells more about how the shortcode is processed:

    [mla_gallery post_parent=all post_mime_type=application/pdf mla_debug=true]

    Towards the end of the debug information you may see something like:

    mla_debug post_count = 0
    mla_debug empty gallery, 
    

    That would mean that the shortcode did not find any items to display. You can copy the debug information and post it here for my further investigation.

    Any additional details you can provide will be helpful. Thanks!

    You should also have a close look at your shortcodes in the editor’s “Text” tab, not the “Visual” tab to make sure that there are no special or encoded characters in them.

    Thread Starter somecows

    (@somecows)

    Thanks so much for your help. I really appreciate it. I tried some of your suggestions.

    [mla_gallery post_parent=all] works. I get a thumbnail of all my images.

    [mla_gallery ids=9999 post_mime_type=all] does NOT seem to work when I substitute the ID of a pdf. it does work if I use the ID of a jpg instead.

    I’m posting all the debug results below. its super long. sorry!

    it seems like my problem is specific to PDFs. could I be missing some setting or software on my server, or something?

    548 mla_debug REQUEST = array ( ‘customize_changeset_uuid’ => ‘7153dc08-cb44-4afc-b4d5-c1f281257095’, ‘customize_theme’ => ‘make-child’, ‘customize_messenger_channel’ => ‘preview-23’, ‘customize_autosaved’ => ‘on’, ‘_method’ => ‘GET’, ‘wp_customize’ => ‘on’, ‘nonce’ => ‘fecb4e803a’, ‘customized’ => ‘{\\”widget_mla-text-widget[4]\\”:{\\”encoded_serialized_instance\\”:\\”YTo0OntzOjU6InRpdGxlIjtzOjA6IiI7czo0OiJ0ZXh0IjtzOjc1OiJbbWxhX2dhbGxlcnkgcG9zdF9wYXJlbnQ9YWxsIHBvc3RfbWltZV90eXBlPWFwcGxpY2F0aW9uL3BkZiBtbGFfZGVidWc9dHJ1ZV0iO3M6NjoiZmlsdGVyIjtiOjA7czoxNDoidGV4dHdpZGdldF9kaXYiO2I6MTt9\\”,\\”title\\”:\\”\\”,\\”is_widget_customizer_js_value\\”:true,\\”instance_hash_key\\”:\\”dbf5939bce46f44e1ab58b513c956dca\\”}}’, )

    549 mla_debug attributes = array ( ‘post_parent’ => ‘all’, ‘post_mime_type’ => ‘application/pdf’, ‘mla_debug’ => ‘true’, ‘mla_page_parameter’ => ‘mla_paginate_current’, )

    550 mla_debug arguments = array ( ‘size’ => ‘thumbnail’, ‘itemtag’ => ‘figure’, ‘icontag’ => ‘div’, ‘captiontag’ => ‘figcaption’, ‘columns’ => ‘3’, ‘link’ => ‘permalink’, ‘id’ => NULL, ‘style’ => NULL, ‘type’ => ‘default’, ‘thumb_width’ => 75, ‘thumb_height’ => 75, ‘thumbnail_size’ => ‘thumbnail’, ‘slide_size’ => ‘large’, ‘slideshow_height’ => 500, ‘fx’ => ‘fade’, ‘timeout’ => 4000, ‘speed’ => 1000, ‘pause’ => NULL, ‘mla_output’ => ‘gallery’, ‘mla_style’ => ‘default’, ‘mla_markup’ => ‘default’, ‘mla_float’ => ‘left’, ‘mla_itemwidth’ => ‘calculate’, ‘mla_margin’ => ‘1.5%’, ‘mla_target’ => ”, ‘mla_debug’ => ‘true’, ‘mla_named_transfer’ => false, ‘mla_viewer’ => false, ‘mla_single_thread’ => false, ‘mla_viewer_extensions’ => ‘ai,eps,pdf,ps’, ‘mla_viewer_limit’ => ‘0’, ‘mla_viewer_width’ => ‘0’, ‘mla_viewer_height’ => ‘0’, ‘mla_viewer_best_fit’ => NULL, ‘mla_viewer_page’ => ‘1’, ‘mla_viewer_resolution’ => ‘0’, ‘mla_viewer_quality’ => ‘0’, ‘mla_viewer_type’ => ”, ‘mla_alt_shortcode’ => NULL, ‘mla_alt_ids_name’ => ‘ids’, ‘mla_alt_ids_value’ => NULL, ‘mla_end_size’ => 1, ‘mla_mid_size’ => 2, ‘mla_prev_text’ => ‘? Previous’, ‘mla_next_text’ => ‘Next ?’, ‘mla_paginate_type’ => ‘plain’, ‘mla_paginate_rows’ => NULL, ‘mla_link_attributes’ => ”, ‘mla_link_class’ => ”, ‘mla_link_href’ => ”, ‘mla_link_text’ => ”, ‘mla_nolink_text’ => ”, ‘mla_rollover_text’ => ”, ‘mla_image_class’ => ”, ‘mla_image_alt’ => ”, ‘mla_image_attributes’ => ”, ‘mla_caption’ => ”, )

    mla_debug is_archive() = false

    mla_debug is_search() = false

    mla_debug $wp_filter[posts_where] priority = 2147483647
    filter name = ‘MLAShortcode_Support::mla_shortcode_query_posts_where_filter’

    mla_debug $wp_filter[posts_orderby] priority = 2147483647
    filter name = ‘MLAShortcode_Support::mla_shortcode_query_posts_orderby_filter’

    mla_debug WHERE filter = ‘ AND (wpvu_posts.post_mime_type = \’application/pdf\’) AND wpvu_posts.post_type = \’attachment\’ AND ((wpvu_posts.post_status = \’inherit\’))’

    mla_debug modified WHERE filter = ‘ AND (wpvu_posts.post_mime_type = \’application/pdf\’) AND wpvu_posts.post_type = \’attachment\’ AND ((wpvu_posts.post_status = \’inherit\’))’

    mla_debug ORDER BY filter, incoming = ‘wpvu_posts.post_date DESC’
    Replacement ORDER BY clause = ‘wpvu_posts.menu_order ASC, wpvu_posts.ID ASC’

    mla_debug posts_clauses filter = array ( ‘where’ => ‘ AND (wpvu_posts.post_mime_type = \’application/pdf\’) AND wpvu_posts.post_type = \’attachment\’ AND ((wpvu_posts.post_status = \’inherit\’))’, ‘groupby’ => ”, ‘join’ => ”, ‘orderby’ => ‘wpvu_posts.menu_order ASC, wpvu_posts.ID ASC’, ‘distinct’ => ”, ‘fields’ => ‘wpvu_posts.*’, ‘limits’ => ”, )

    mla_debug posts_clauses_request filter = array ( ‘where’ => ‘ AND (wpvu_posts.post_mime_type = \’application/pdf\’) AND wpvu_posts.post_type = \’attachment\’ AND ((wpvu_posts.post_status = \’inherit\’))’, ‘groupby’ => ”, ‘join’ => ”, ‘orderby’ => ‘wpvu_posts.menu_order ASC, wpvu_posts.ID ASC’, ‘distinct’ => ”, ‘fields’ => ‘wpvu_posts.*’, ‘limits’ => ”, )

    mla_debug query = array ( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘application/pdf’, ‘nopaging’ => true, ‘ignore_sticky_posts’ => true, ‘no_found_rows’ => false, )

    mla_debug request = ‘SELECT wpvu_posts.* FROM wpvu_posts WHERE 1=1 AND (wpvu_posts.post_mime_type = \’application/pdf\’) AND wpvu_posts.post_type = \’attachment\’ AND ((wpvu_posts.post_status = \’inherit\’)) ORDER BY wpvu_posts.menu_order ASC, wpvu_posts.ID ASC ‘

    mla_debug query_vars = array ( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘application/pdf’, ‘nopaging’ => true, ‘ignore_sticky_posts’ => true, ‘no_found_rows’ => false, ‘error’ => ”, ‘m’ => ”, ‘p’ => 0, ‘post_parent’ => ”, ‘subpost’ => ”, ‘subpost_id’ => ”, ‘attachment’ => ”, ‘attachment_id’ => 0, ‘name’ => ”, ‘static’ => ”, ‘pagename’ => ”, ‘page_id’ => 0, ‘second’ => ”, ‘minute’ => ”, ‘hour’ => ”, ‘day’ => 0, ‘monthnum’ => 0, ‘year’ => 0, ‘w’ => 0, ‘category_name’ => ”, ‘tag’ => ”, ‘cat’ => ”, ‘tag_id’ => ”, ‘author’ => ”, ‘author_name’ => ”, ‘feed’ => ”, ‘tb’ => ”, ‘paged’ => 0, ‘meta_key’ => ”, ‘meta_value’ => ”, ‘preview’ => ”, ‘s’ => ”, ‘sentence’ => ”, ‘title’ => ”, ‘fields’ => ”, ‘menu_order’ => ”, ’embed’ => ”, ‘category__in’ => array ( ), ‘category__not_in’ => array ( ), ‘category__and’ => array ( ), ‘post__in’ => array ( ), ‘post__not_in’ => array ( ), ‘post_name__in’ => array ( ), ‘tag__in’ => array ( ), ‘tag__not_in’ => array ( ), ‘tag__and’ => array ( ), ‘tag_slug__in’ => array ( ), ‘tag_slug__and’ => array ( ), ‘post_parent__in’ => array ( ), ‘post_parent__not_in’ => array ( ), ‘author__in’ => array ( ), ‘author__not_in’ => array ( ), ‘suppress_filters’ => false, ‘cache_results’ => true, ‘update_post_term_cache’ => true, ‘lazy_load_term_meta’ => true, ‘update_post_meta_cache’ => true, ‘posts_per_page’ => 10, ‘comments_per_page’ => ’50’, ‘order’ => ‘DESC’, )

    mla_debug post_count = 9

    Plugin Author David Lingren

    (@dglingren)

    Thanks for giving the tests a try and for posting the debug information. You can see “mla_debug post_count = 9” in the debug results, so the [mla_gallery] shortcode is finding and attempting to display the PDF gallery.

    There may be something in your theme or some other plugin that interferes with the gallery display. Or, something may have gone wrong with the display of the PDF thumbnail images supplied by WordPress.

    On the Media/Assistant and Media/Library screens, do you PDF documents have a small thumbnail image of their first page? When you use the Media/Edit Media full screen editing page do you see an image there?

    You can try adding size=none or size=icon-only to your shortcodes to see if they will display the PDF Title or icon.

    Can you post a link to one of your posts/pages with the missing gallery? If not, can you use the browser’s tools to look at the HTML source text of the post/page and see if the gallery display HTML is being generated?

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

    Thread Starter somecows

    (@somecows)

    Thanks again for your help. It is super nice of you.

    I tried adding size=none and got no change. I also tried adding size=icon-only but got no change.

    When I go to the media library I do NOT see a thumbnail of the first page of my PDFs. I just see the PDF icon – a sort of red fancy triangle. and when I use the full screen edit option, I see the same default icon. I had no idea WordPress was supposed to be able to display an actual image from the PDF. Or is that functionality being added by your plugin?

    Unfortunately I cannot paste a link to the page as it is not live. I mean, it’s running live on my server, but DNS for the domain is not pointing to this version of the site.

    do you have any idea what this would mean? my server is running pretty up to date software of all varieties, and my WordPress is all up to date. There are no ACTIVE plugins installed other than something called Loginizer which gets installed as an option with WordPress, and then my theme (Make Plus).

    If you could clarify whether being able to see an image of the PDF’s first page is default behavior of WordPress whether functionality that is added by your plugin, that would be great.

    Is some sort of extension required on the server in order to display PDF images, or anything like that?
    Thanks for any thoughts.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the test results and additional details. Thanks as well for mentioning your theme, which turns out to be the answer to your problem. Your theme is preventing the display of your PDF gallery.

    I installed the Make theme and ran some tests. Since your PDFs do not have thumbnails (see below), WordPress and MLA substitutes the document title and displays it in the Caption. Your theme’s style.css style sheet suppresses captions in the default gallery display (lines 2326 through 2332 in the file).

    You can fix this by creating custom [mla_gallery] style or markup templates and either changing the class attributes for .gallery-icon and .gallery-caption to something else or overriding the theme’s default styles. You can also add styles using the Theme Customizer’s “Additional CSS” section. I was not able to find a theme setting to enable caption display. Let me know if you need more specific guidance.

    The simplest answer would be to use size=icon or size=icon_only (note the underscore; my earlier post had a dash, which was wrong. I regret the error). Of course, since your theme suppresses captions you won’t be able to tell which document is which. If you can fix that you can add something like mla_caption="{+post_title+]" to your shortcode to use the item’s Title as a caption.

    You wrote “ I had no idea WordPress was supposed to be able to display an actual image from the PDF.” This feature was added in WP 4.7, as described here:

    Enhanced PDF Support in WordPress 4.7

    Note that this feature “requires Imagick, ImageMagick, and Ghostscript support“. If you go to the Settings/Media Library Assistant Shortcodes tab and scroll down to the “Thumbnail Substitution Support, mla_viewer” section on the left you can see some options to enable MLA’s PDF thumbnail handling. Below the “Enable thumbnail substitution” option there would be a warning message if you don’t have the required support.

    MLA has a couple of other features for PDF thumbnails as well. Have a look at the “Thumbnail Substitution Support, mla_viewer” section of the Settings/Media Library Assistant Documentation tab. You can also pull down the Help menu in the upper-right corner of the Media/Assistant admin submenu and look at the “Thumbnail Generation” tab on the help menu for other options.

    I hope that gets you started on a fix that works for your theme and application. I am marking this topic resolved, but please update it if you have problems or further questions regarding the above suggestions; I will give you whatever help I can. Thanks for your interest in MLA.

    I am having what I think is the same problem (see: https://www.dofedorset.org/handy-resources/) and have attempted to follow the instructions laid out already. I note that in Settings > Shortcodes, ‘enable thumbnail substitution’ is warning me that ‘Imagick support is not installed’.

    However, I cannot find ‘Imagick’ available to download and install anywhere?!

    Plugin Author David Lingren

    (@dglingren)

    @alexfwalker – Thanks for the link to your site and for your question.

    Imagick, ImagMagick and Ghostscript are not available in the normal WordPress plugin/theme repositories. You must work with your web site hosting company to install them on your server and make them available to PHP and WordPress. Here are two earlier support topics with more information:

    Problem and suggestion regarding thumbnails (from pdf) and Ghostscript

    Featured Image for mla_viewer

    If you can get them installed you can use the “Thumbnail” bulk action on the Media/Assistant submenu to generate thumbnail images for your existing PDF documents. Please post an update or (better yet) start a new topic if you have problems or further questions regarding the suggestions in the earlier topics. Thanks for your interest in MLA.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Not working for PDFs’ is closed to new replies.