CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Broken Images on PDF Letter
Pages: [1]

Author Topic: Broken Images on PDF Letter  (Read 1879 times)

nessnzoe

  • I post occasionally
  • **
  • Posts: 84
  • Karma: 2
    • GingerFeet LLC
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.14
  • PHP version: 5.3.6
Broken Images on PDF Letter
December 14, 2011, 12:38:55 pm
Hi all,

We're having an issue with images breaking when we make PDF Letters.

The image appears in the editor when setting up the PDF Letter, but is a broken link when the PDF Letter is actually created.

Does anyone have any ideas what would be causing this? I've tested on your demo site and the image appears, but you are running 36849 on the demo site.

Any help is appreciated.
Vanessa

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Broken Images on PDF Letter
December 20, 2011, 09:02:37 am
Quote
Does anyone have any ideas what would be causing this? I've tested on your demo site and the image appears, but you are running 36849 on the demo site.
Demo is run from svn install, hence above number is revision number. I would suggest upgrading to latest 3.4.8 stable release.

Kurund
Found this reply helpful? Support CiviCRM

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Broken Images on PDF Letter
January 03, 2012, 07:29:49 am
Interesting (and frustrating) tidbit: When generating a PDF receipt for a contribution in my personal Ubuntu sandbox, images that were uploaded (via Drupal) to files/ (e.g., files/dn-logo-transparent.png) appear in the PDF.  But when doing the same on an Openwall GNU/Linux host (Openwall is based on Redhat) the images are broken - only the ALT text appears.

Both sites are running v3.4.8 -- though I experienced the same circumstances when running v3.4.5 before the upgrade.

It is fairly urgent for our client that this is fixed.  I'm working on debugging it and will post here if/when I find a solution - and/or the cause of the problem.

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Broken Images on PDF Letter
January 03, 2012, 10:26:18 am
I got this working.

I replaced:
Code: [Select]
<img src="http://example.org/sites/example.org/files/logo-transparent.png" alt="[Example logo]">with:
Code: [Select]
<img src="sites/example.org/files/logo-transparent.png" alt="[Example logo]">...and the images appear.

Update: Our servers have allow_url_fopen = 0 by default; setting this value to '1' will allow dompdg to grab the HTML via HTTP for processing.  This is useful if you want to be able to send HTML-formatted email receipts as well as print PDF.
« Last Edit: January 30, 2012, 12:56:18 pm by fen »

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Broken Images on PDF Letter
January 03, 2012, 12:07:26 pm
More info as to the probable cause (thanks to colleague Owen Barton): dompdf needs to load the file in PHP, so it probably worked in my sandbox because my local php fopen (or equiv) allowed fetching the file via http (which is a security risk and not allowed by default on our servers). Giving it the actual file path means it can just load the file directly.

nessnzoe

  • I post occasionally
  • **
  • Posts: 84
  • Karma: 2
    • GingerFeet LLC
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.14
  • PHP version: 5.3.6
Re: Broken Images on PDF Letter
January 06, 2012, 01:26:17 pm
Hi fen,

Sorry for the delay in the reply!

Thanks for both your thoughts. I'll pass everything on to our developer. We did spend one afternoon going through everything that was suggested on the DOMPDF forum about making it work and nothing did.  :'(

Thanks,
Vanessa

simonium

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
Re: Broken Images on PDF Letter
January 24, 2012, 01:41:49 am
Hi Guys,

We have a client who is experiencing a similar issue.  They have a number of sites running CiviCRM and they're experiencing this issue in all of them.  Basically, as you described, the images are showing in the editor (FCK) but aren't showing up in the PDF.

I looked at the PDF letter template, and it seems that the url of the images are in the format : /sites/www.website.com/files/images/image_name.png. 

Is this problem related to Drupal's multi-site configuration? Does anyone know a way around it?

Any and all help is much appreciated . . .

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Broken Images on PDF Letter
January 24, 2012, 06:16:27 am
I don't have much to offer, as you're already pulling the file directly from the filesystem (which fixed the issue I was having when I was initially accessing them via http).  But here's some things to try:
  • Make sure the file has read permissions
  • Test to make sure you can see the file using http at http://www.website.com/sites/www.website.com/files/images/image_name.png
  • Check your logs
If you're still running into trouble, post more info like what process you are using to create the image and at what URL you are experiencing the fail.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Broken Images on PDF Letter

This forum was archived on 2017-11-26.