1

Upgrading from 4.4 to 4.6.14 and I'm struggling to correct an issue with BOM being added to contact images. Note that this isn't custom fields, just the image_url that's part of the organizational contact.

I created a new contact and added an image, so this is a totally new image and doesn't have anything to do with a problem with upgrading the data.

The image loads correctly if I load it directly: http://[mysite]/sites/default/files/civicrm/custom/[myfile]

But I get a broken image on the summary tab. Loading that into a new window its URL is http://[mysite]/civicrm/contact/imagefile?photo=[myfile]

After fighting with it for a while I read about problems with BOM and sure enough after I changed [mysite]/sites/all/modules/civicrm/CRM/Contact/Page/ImageFile.php to force the file to download rather than display and then compared that downloaded file to the original it's 3 bytes longer.

Opening it in a hex editor and I can see that the 3 bytes at the beginning are different and are EF BB BF in other words the BOM.

So now my challenge is to figure out how to get that to stop.

I've double checked that ImageFile.php is saved as UTF-8 no BOM. Examining it with the hex editor and there's no BOM.

I tried using a find command I googled up to find all BOM starting files and fixed or deleted all them. That didn't make any difference. Still got the BOM.

If anyone has any suggestions about how to further debug or solve this, it would be much appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.