3

I've attached some JPG files to notes in contact records, but them I can't open them and if I save them locally then most applications can't open teh saved version and say they aren't in a supported file format, though surprising, Adobe Acrobat will open them (which is not a solution for most users).

I'm using WordPress 5.3, CiviCRM 5.15.1

Any ideas what could be going on?

5
  • I've now found that Word (.docx) files also have problems and Word says I need to select an encoding to make the file readable. But all options leave it as nonsense or hang. So I suspect an encoding issue for JPG as well. I'm uploading and downloading from Windows. – Mick Kahn Dec 11 '19 at 22:56
  • I haven't checked 5.15.1 but using windows against wpmaster.demo.civicrm.org it works ok for me. If you can't share the full file are you able to edit the question to include the first couple bytes of the file? If you find the file in the civicrm/custom folder on the server you can use something like od -xc filename.jpg | head from a shell. – Demerit Dec 12 '19 at 2:48
  • It works for me as well on the demo site. I don't have shell access (so can't use od to view the file) but accessing it via cPanel file manager, the file opens fine via any image app, so it looks as if the file is uploaded and stored correctly. Also I think Windows is excluded as I have also tried upload and view from an iPad with exactly the same result. – Mick Kahn Dec 12 '19 at 11:05
  • Ok this sounds like you have an extension or customized code file that is inserting a blank line or something, like a php file that doesn't start with <?php. If you open the corrupted downloaded file using notepad what do you see at the start of the file? – Demerit Dec 12 '19 at 13:31
  • 1
    That's very useful and with HxD installed on Windows I can compare the files and indeed there is an 0A at the start of the corrupt file and its fine once that is removed. I get the same on two different installations (different, but neither latest, versions of CiviCRM) and I have no extensions in common and no customised code, but obviously the next step is to try upgrading a site to the latest version or run a clean installation. – Mick Kahn Dec 12 '19 at 18:21
3

Eventually I found out what the problem is and it is caused by the child theme that I had created. Another problem elsewhere that had an extra blank line at the start of a news feed and Demerit's comment above suggested this as a solution. When I changed to the base theme all was fine. Going back to functions.php for the child theme I found a blank line outside (though not at the start of the file which is why Demerit's suggestion didn't lead me to the solution before).

0

Do you have Shoreditch theme installed? This will complicate a few things in WordPress and even the fabulous CiviCRM Admin Utilities WP-Plugin won't fix it.

Try this extension from bgm: https://civicrm.org/extensions/shoreditch-wordpress-workarounds

2
  • I don't have Shoreditch installed and I've indicated what the problem was. I think you are referring to the Shoreditch CiviCRM extension which requires Drupal. Not clear what specific problems the extension you reference refers to. But there is also a WordPress theme called Shoreditch! – Mick Kahn Sep 24 '20 at 16:02
  • You are able to install Shoreditch CiviCRM-extension on WordPress, too. UX is worth it! But please fix small problems with bgm's extra-extension because Shoreditch is for Drupal mainly. functions.php resolved your issue - fine ;) – wintermoor Sep 25 '20 at 23:13

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.