• Resolved dev

    (@devksec)


    Hello,

    Our WP site uses webp overwriting, so logos aren’t showing. Reviewing a previous ticket 3 years back, webp images aren’t supported. Has this changed yet ?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @devksec,

    The default PDF engine we use, dompdf, support WebP images since 1.1.1 (see changelog), if your hosting supports WebP images, the images should be displayed correctly.

    You can check this in WooCommerce > PDF Invoices > Advanced > Status > System configuration > WebP Support.

    Thread Starter dev

    (@devksec)

    Hello,

    We’re using pro v2.15.11 however our logo has disappeared from our invoices (unsure to when). It does show webp image is supported under the status, so that doesn’t appear to be the cause.

    The logs show a critical error and header image not found (Critical Header logo file not found.). However encoding a .png image URL into a template works.

    On review, also adding manually a .webp image also works, so its the logo via the “Shop header/logo” under general settings which doesn’t seem to work with the simple premium template theme.

    • This reply was modified 1 year, 6 months ago by dev.
    Thread Starter dev

    (@devksec)

    Specifically, this code is having to be replaced with an img tag to resolve it. We’ve not changed our logo in sometime or made any changes.

        <td class="header">
            <?php
                if ( $this->has_header_logo() ) {
                    do_action( 'wpo_wcpdf_before_shop_logo', $this->get_type(), $this->order );
                    $this->header_logo();
                    do_action( 'wpo_wcpdf_after_shop_logo', $this->get_type(), $this->order );
                } else {
                    $this->title();
                }
            ?>
        </td>
    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for providing more details, @devksec:

    Please note that PDF invoices created previously are not updated when you change the plugin’s settings in a latter stage, therefore, if you change your settings for the shop or the document (like the shop logo), the previous invoices will not be affected, displaying nothing (if there was not a shop logo set at the moment of its generation) or the previous value for the setting, if it was different.

    In brief, we store the settings for both, document and shop, per-order basis for historical reasons. For instance, if you change your shop address in the future, it should not affect old PDF invoices that you generated when your store was located in the old address.

    That said, if you are just playing with the plugin configuration, or this is a new installation, you could try to activate the “Test mode” temporarily, under WooCommerce > PDF Invoices > General > Test mode. See: Show PDF documents with the latest settings.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    By the way, you mentioned that adding the .PNG image in the template code works, but instead of editing the core files directly, I would recommend using our default “Simple” template in combination with a code snippet hooked to our PDF templates filter hooks, which is a safer method, as I did here:

    /**
    * PDF Invoices & Packing Slips for WooCommerce:
    * Set a shop logo manually (this will override the shop logo in the plugin's settings)
    */
    add_filter( 'wpo_wcpdf_header_logo_img_element', function( $img_element, $attachment) {
    // Set the URL of your shop logo below:
    $shop_logo_url = 'https://img.logoipsum.com/288.svg';
    return "<img src='{$shop_logo_url}'/>";
    }, 10, 2 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use code snippets

    Thread Starter dev

    (@devksec)

    Hello,

    In test mode and the preview, the store logo does not show at all and the error is within the logs. Only when the image is hardcoded does it show.

    Using simple template does not work either.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Did you check if the Web support is on/green in WooCommerce > PDF Invoices > Advanced > Status > System configuration > WebP Support?

    Thread Starter dev

    (@devksec)

     It does show webp image is supported under the status, so that doesn’t appear to be the cause.

    It’s not possible to test on our store non .web images via the media library are all webp with a CDN redirect however the .webp images when hard coded into the template so doesn’t seem to be a webp issue.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for providing more details, @devksec:

    Did you try the code snippet I shared above to set your shop logo manually?

    I have tried the following code in my staging site, using a WebP image for the shop logo, and it worked:

    /**
    * PDF Invoices & Packing Slips for WooCommerce:
    * Set a shop logo manually (this will override the shop logo in the plugin's settings)
    */
    add_filter( 'wpo_wcpdf_header_logo_img_element', function( $img_element, $attachment) {
    // Set the URL of your shop logo below:
    $shop_logo_url = 'https://i.postimg.cc/13GnwHY7/288.webp';
    return "<img src='{$shop_logo_url}'/>";
    }, 10, 2 );

    You can try with the same code, to “free 2 birds with 1 key”: Both confirm that your site uses WebP images and overcome any issues produced by the CDN.

    Please note that the PDF library we use by default, dompdf, is strict with the image URLs, and maybe there is an issue with that in your site, e.g. mixing HTTP with HTTPS.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘webp image support’ is closed to new replies.