• Resolved mcziel

    (@mcziel)


    Hello,

    After migrating my media to s3 and using CloudFront as CDN, the logo in the invoice template is not showing up, instead is showing “image not found or type unknown”. I can see the image in the Shop header/logo field though.

    Thanks beforehand.

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

    (@yordansoares)

    Hi @mcziel,

    This issue is often produced when the image can’t be fetched, whether because the image doesn’t exist (e.g. it has been deleted) or can’t be loaded somehow (e.g. because an SSL certificate issue).

    That said, could you check HTML output source to see if the image is loading there? To do it, just add &output=html at the end of your invoice/packing slip URL.

    Thread Starter mcziel

    (@mcziel)

    When I added &output=html to the URL and it printed the HTML I was able to see the image properly.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Could you please send the HTML output source to scan the code and try to understand what’s happening? To do it, please Right-click > Save as…, and save it as HTML. You can use https://filebin.net/ to upload the file and share the bin URL here.

    Thread Starter mcziel

    (@mcziel)

    I am sorry, I couldn’t upload it to filebin.net I was getting “insufficient storage” which is weird because the file’s size is 7 kb.

    You can check the file here https://we.tl/t-f11N1y7CFC

    I notice that when the file is saved the image path is different, through inspect HTML the image path looks like this:

    <img src="https://cdn.HIDDENDOMAIN.com/wp-content/uploads/2022/01/09030600/HIDDENIMAGENAME.png" alt="HIDDENALT" />

    While the saved file looks like this:

    <img src="./invoice_files/HIDDENIMAGENAME.png" alt="HIDDENALT" />

    • This reply was modified 2 years, 3 months ago by mcziel.
    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @mcziel,

    I am sorry, I couldn’t upload it to filebin.net I was getting “insufficient storage” which is weird because the file’s size is 7 kb.

    You’re right: It seems that filebin.net was out of storage yesterday: This is the first time I see that!

    You can check the file here https://we.tl/t-f11N1y7CFC

    Thanks for sharing the HTML output of your invoice!

    I think the URL replacement is made by the browser on saving. However, I think you gave me a hint about this issue: The URL of the image starts with https://cdn.example.com/[...], which made me think that this is causing an SSL validation issue in our PDF engine (dompdf).

    Please add this code snippet to your site to check if the logo image appears correctly:

    add_filter( 'wpo_wcpdf_use_path', '__return_true', 999 );

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

    Let me know if it worked!

    Thread Starter mcziel

    (@mcziel)

    Hi,

    I added the filter but it is not working, now I am getting this path:

    s3useast1://HIDDENBUCKETNAME/wp-content/uploads/2022/01/09030600/HIDDENNAME.png

    =/

    Thread Starter mcziel

    (@mcziel)

    Anything else I could try?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @mcziel,

    Sorry for taking so long to reply!

    I wonder if replacing the URL protocol from https:// to https:// would do the trick.

    If you haven’t found a way to fix it yet, please try with the following code snippet:

    add_filter( 'wpo_wcpdf_get_html', function( $html, $document ) {
    	$html = str_replace( 'https://', 'https://', $html);
    	return $html;
    }, 10, 2);
    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @mcziel,

    Since we haven’t heard back from you in the last two weeks, we’re assuming you solved this issue, so I’ll go ahead and mark this ticket as Resolved.

    Feel free to reply to this topic is you still need help with this, or open a new topic if you have any other questions!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Image not found or type unknown (S3 / CloudFront)’ is closed to new replies.