• I’v created a form. within the form are radio button questions that display an image. So depending on which radio button is selected a different image will appear. This is working correctly when it comes to the regular emailed form. However, the images are not appearing on the PDF version of the form, they are showing on the PDF as a small white square with a red X through it – as if is was a missing image or incorrect url to an image.

    Any help to overcome this issue would be great.

    https://wordpress.org/plugins/gravity-forms-pdf-extended/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jake Jackson

    (@blue-liquid-designs)

    When viewing the PDF via your admin area, if you add &html=1 to the URL in your address bar and reload the page do the images display correctly?

    Thread Starter sdwm

    (@sdwm)

    Yes, that works correctly. How do I ensure that the PDF that is sent with the emailed form displays the images correctly?

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Thanks for clarifying. We’ve had reports of this issue previously but thus far haven’t been able to track down the root cause(s). Are you running your WordPress installation locally, or from an unregistered domain name? Or is the website live on the web?

    Thread Starter sdwm

    (@sdwm)

    No. It’s a registered domain, but the form sits on a private page restricted by WordPress’ password feature.

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Thanks for the clarification.

    If you are using a custom PDF template you can use PHP to covert your URLs into absolute paths. That will definitely fix the problem. At this stage we’re not sure on why the URLs aren’t being processed correctly.

    Thread Starter sdwm

    (@sdwm)

    Thanks for the update.

    Are you able to confirm how I go about doing this? i.e. show an example?

    Thanks again.

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    You can use a str_replace():

    $img = str_replace( home_url(), ABSPATH, $img ); /* where $img is your image URL */
    Thread Starter sdwm

    (@sdwm)

    Just to clarify, the images that are not showing are part of a radio button selection option. i.e. the label of the radio buttons are as follow:

    1) LabelName1 <img class=”pre-imgs” src=”http://www.mydomain.co.uk/wp-content/uploads/2015/07/image1.jpg&#8221; alt=”” />

    2) LabelName2 <img class=”pre-imgs” src=”http://www.mydomain.co.uk/wp-content/uploads/2015/07/image2.jpg&#8221; alt=”” />

    etc. etc

    Therefore it is currently using an absolute path.

    This radio button form currently has 7 options to select 1 from.

    Therefore, I’m note sure how or where I am to use your str_replace(): detail above.

    Any further clarification would be much appreciated?

    Thanks

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Those images in your radio buttons are using URLs, not an absolute path, so you can still convert them.

    Because they are in a label it is a little trickier to convert but you can do it using the following technique.

    At the beginning of the PDF template start a buffer:

    <?php 
    
    ob_start();

    Then at the very end of the template, capture the buffer, do the conversion and output the results.

    $html = ob_get_clean();
    echo str_replace( home_url(), ABSPATH, $html );
    Thread Starter sdwm

    (@sdwm)

    Thanks I’ve applied this to the PDF template as described. Now the images ARE appearing which is great, but I have lost all my formatting on the PDF, so all the information is coming through as unformatted text?

    Any ideas?

    Thread Starter sdwm

    (@sdwm)

    Further update, if I store the images on a separate website i.e. completely different url, they seem to work fine?

    Could the issue be something else completely. I’ll carry out further tests on a new domain, I’ll limit the plug-ins being used and even keep to a simple WordPress default theme and report back.

    Would that be a useful test?

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    That’s odd about the text formatting issue… What about if you place <?php ob_start(); ?> after the opening <body> tag. Does that have any effect?

    Yes. Further testing and feedback would be very useful. Thanks.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘image selected or added via form question now showing on PDF’ is closed to new replies.