Answers.Body: <p>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.</p>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Hopefully this helps you out, please let me know if you have any further questions or need extra help.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-22T06:36:36.210Z
Answers.Text: Thanks for your solution Jade. My 'rogue' was a custom module my dev had created.
Answers.UserDisplayName: Davy Ivins
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-26T10:59:03.200Z
Answers.LastActivityDate: 2019-11-26T10:59:03.200Z
Answers.UserDisplayName: Jade
Body: <p>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?
  <a href="https://i.sstatic.net/KJ1lS.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KJ1lS.jpg" alt="image"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-14T19:57:14.560Z
Comments.Text: Have you tried with other image files, or just the one?
Comments.UserDisplayName: Laryn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-15T07:15:55.467Z
Comments.Text: 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.
Comments.UserDisplayName: Adrian
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-15T14:25:18.040Z
Comments.Text: 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!
Comments.UserDisplayName: Jade
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-26T08:37:55.843Z
Comments.Text: 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?
Comments.UserDisplayName: Adrian
Tags: <webform-civicrm><contact-image>
Title: Image from Civicrm contact not shown
ThreadText: # Image from Civicrm contact not shown
  
  (Asked by: username_0 on 2019-11-14)
  
  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](https://i.sstatic.net/KJ1lS.jpg)](https://i.sstatic.net/KJ1lS.jpg)
  
  **Tags:** webform-civicrm, contact-image
  
  > **Comments:**
  > **username_1**: Have you tried with other image files, or just the one?  
  > **username_0**: 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.  
  > **username_2**: Hi username_0, 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!  
  > **username_0**: 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?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-11-26. Score: 2
  
  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.
  
  > **Comments:**
  > **username_3**: Thanks for your solution username_2. My 'rogue' was a custom module my dev had created.  
  
  ---
  
  