I'm using Drupal with CiviCRM 4.7.30 (but this issue also affected 4.6) on Nginx & Debian
I have a custom field used for images. Images are uploaded and stored correctly (when copying the image directly from the server it looks good), but when viewed or downloaded via /civicrm/file? the image is broken.
Using a hex viewer to inspect the files I've found that CiviCRM is adding '0A0A' to the start of the file (see attached screenshot)
Has anyone experienced this? Could this be an Nginx or Php issue rather than Civi?