• Getting broken images in the flyer when generated. I’m using a custom template that pulls in ACF custom fields.

    Screenshot of flyer: https://monosnap.com/file/JYEMYVNJV2wkucovlsstjUjDfiqNQp

    All the red X’s are broken images from the template. The red lined-out text content get is properly getting pulled into the flyer from ACF fields as well, so that part is working, somehow images aren’t though.

    Here’s a snippet of code that I’m using to pull in the first image:

    <?php if ($flyer): ?>
    <img style="border: none; display:block; padding: 0; margin: 0;" border="0" src="<?php echo $flyer['url']; ?>" alt="" />
    <?php endif; ?>

    Figure if we can fix one image, i’ll know how to fix the rest.

    Also all plugins, WP version, and PHP version are all updated.

    Please advise. Thank you!

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

    (@dinamiko)

    Hello @drevans711,

    To debug image errors, please add this line after mpdf creation here :

    $mpdf->showImageErrors = true;

    This line will display the image error in the screen instead of the PDF, once we know the error we could try to fix it, usually image errors are related to PHP extensions not installed on the server, issues with image paths.

    When you get the error please let me know here what the error is about (ex. “Could not find image file” or missing extension…), thanks.

    Thread Starter drevans711

    (@drevans711)

    Adding that line gave me the WordPress critical error message.

    Error log inside of WPE stated the following:

    PHP Fatal error: Uncaught Dinamiko\DKPDF\Vendor\Mpdf\MpdfImageException: Could not find image file (https://hfmintranets.wpengine.com/wp-content/uploads/2025/05/INTRANET-TEACHER-APPRECIATION.jpg) in /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Image/ImageProcessor.php:575#012Stack trace:#012#0 /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Image/ImageProcessor.php(197): Dinamiko\DKPDF\Vendor\Mpdf\Image\ImageProcessor->imageError(‘https://hfmintr…&#8217;, true, ‘Could not find …’)#012#1 /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Tag/Img.php(276): Dinamiko\DKPDF\Vendor\Mpdf\Image\ImageProcessor->getImage(‘https://hfmintr…&#8217;, true, true, ‘https://hfmintr…&#8217;, false)#012#2 /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Tag.php(240): Dinamiko\DKPDF\Vendor\Mpdf\Tag\Img->open(Array, Array, 7)#012#3 /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Mpdf.php(13921): Dinamiko\DKPDF\Vendor\Mpdf\Tag->OpenTag(‘IMG’, Array, Array, 7)#012#4 /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/includes/dkpdf-functions.php(219): Dinamiko\DKPDF\Vendor\Mpdf\Mpdf->WriteHTML(‘ <table width=”…’)#012#5 /nas/content/live/hfmintranets/wp-includes/class-wp-hook.php(324): dkpdf_output_pdf(Object(WP))#012#6 /nas/content/live/hfmintranets/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)#012#7 /nas/content/live/hfmintranets/wp-includes/plugin.php(565): WP_Hook->do_action(Array)#012#8 /nas/content/live/hfmintranets/wp-includes/class-wp.php(835): do_action_ref_array(‘wp’, Array)#012#9 /nas/content/live/hfmintranets/wp-includes/functions.php(1342): WP->main(”)#012#10 /nas/content/live/hfmintranets/wp-blog-header.php(16): wp()#012#11 /nas/content/live/hfmintranets/index.php(17): require(‘/nas/content/li…’)#012#12 {main}#012 thrown in /nas/content/live/hfmintranets/wp-content/plugins/dk-pdf/lib/packages/Mpdf/Image/ImageProcessor.php on line 575

    Please advise how to move forward. Thanks for the help on this!

    Plugin Author dinamiko

    (@dinamiko)

    By the error it seems that the images are not publicly accessible on the server, if I try to access the image https://hfmintranets.wpengine.com/wp-content/uploads/2025/05/INTRANET-TEACHER-APPRECIATION.jpg I get a 403 Forbidden error, probably that could be the reason why the PDF is not able to get those images.

    In this case I suggest to try to host the images used in the PDF somewhere else place that is publicly accessible, not an ideal solution but I think it could work.

    Thread Starter drevans711

    (@drevans711)

    They’re accessible if you’re logged into the site though. Here’s a screenshot of the image file itself from your example: https://monosnap.com/direct/cjGNH9KajkzHBUNBG2dsKhLRzDsukX

    We had this working for a few years using your plugin, so I’m not sure what would’ve made it stop as we haven’t changed anything with the setup outside of plugin updates and server updates (running on WPEngine, PHP version 8.2, and WP version 6.8.1.

    Thread Starter drevans711

    (@drevans711)

    I can also access the image file in an Incognito Window in Chrome as well. You might be blocked if you’re out of the country so that could explain the 403 Forbidden.

    Thread Starter drevans711

    (@drevans711)

    Sooooo this is still happening. Any idea on what the issue could be?

    Plugin Author dinamiko

    (@dinamiko)

    Hello @drevans711,

    I’ve just checked and now I’m able to access the image (https://hfmintranets.wpengine.com/wp-content/uploads/2025/05/INTRANET-TEACHER-APPRECIATION.jpg) correctly, so it has to be something else… one thing that you could try is check if it’s because the server has an SSL certificate issue, so please try to add this new line to see if issue persist or not:

    $mpdf->curlAllowUnsafeSslRequests = true;

    add the above line after this line in this file includes/dkpdf-functions.php and let me know:

    // Create PDF instance
    $mpdf = new Mpdf( $mpdf_config );

    $mpdf->curlAllowUnsafeSslRequests = true;
Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.