duanshaiduhao2471 2015-11-02 09:08
浏览 22
已采纳

Image在文件开头有一个回车符

I was handed over a site for maintenance/enchancement. The site's platform is running on PHP5, older version of OpenCart (1.5.x).

There is a part where the user is able to download image files using a jquery-based file manager to display files from the /image/ folder.

What happens is that the image file after download fails to load in any image editor/viewer application. When I examined the file with a hex editor, I found out that the start of the JPEG or PNG files starts with a 0x0A (a carriage return). This is the one that is causing the image to fail to be read properly, but how it got there has stumped me since this morning.

There is a testing site on another server with a similar setup. The images can be downloaded and opened correctly. The code should be the same. This part was not touched so I am at a loss on why this happens on Live but not on Testing site.

Has anybody encountered this before, and what is the fix?

Thanks!

  • 写回答

1条回答 默认 最新

  • dq_1984 2015-11-02 11:19
    关注

    Oh good lord, there was a carriage return in one of the include files after the ending PHP tag! I should have known this earlier. (facepalm)

    Thanks for all the replies.

    Regards, Marky

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?