3

I'm using Drupal 7.67 and CiviCRM 5.14.2. I can upload a contact image but in the moment I'm not getting any error messages, the images are just displaying as broken image icons. This happens whether I try to attach an image via the edit contact civicrm pages or a profile page. If I copy de url image and download it, when I open the image, it says is broken. Any advice? image

  • Have you tried with other image files, or just the one? – Laryn - CEDC.org Nov 14 at 19:57
  • I've tried with multiple images,sizes (size of php.ini) and extensions. If i upload instead of a image, documents. I can download the document and see it with no errors. – Adrian Nov 15 at 7:15
  • 1
    Hi Adrian, I have had this issue before and found it was due to whitespace. Could you do me a favour and download the image from the link you can see when you inspect it and then open it in a text editor (notepad++, sublime, etc). Let me know whether you find an empty line in the image's 'code'. I know it sounds a little cooky but if so, I know how you can fix it! – Jade Nov 15 at 14:25
  • Hello @Ember, sorry for the delay. I have opened the image file with notepad++ and yes, there are empty lines in the image's code. What did you do to solve this? – Adrian Nov 26 at 8:37
1

So I've found this issue is due to a rogue module or theme in Drupal that has whitespace before or after the PHP opening and closing tags which is being injected into contact images and can also prevent Mosaico images from working as well.

What I suggest you do is disable all modules first (except CiviCRM and related modules as you'll need to test the images). Once you've disabled all the modules, go and check the contact images - they should now appear and if they do, you know you have a module with lines either before or after the PHP tags at the beginning or end of a PHP file.

From there, go through and activate the modules - depending on how many you have, you may want to do one or a few at a time to save a bit of time. I did 5 at a time given how many modules were on the site and when I found the batch that broke the image, I just whittled it down to find the exact one.

Once you've found the module that breaks the contact images - you may need to do a bit of digging in the code to find the whitespace if you definitely need the module. It's also a good idea to inform the maintainer of the module so that they can fix it and prevent anyone else having these issues.

If you find that the contact image is still broken after you have disabled all modules, it may be the theme although this is less likely. The same goes for the themes as above.

Hopefully this helps you out, please let me know if you have any further questions or need extra help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.