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

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

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮