On 06/07/17 22:10, tec...@protonmail.com wrote:
Hello,

I am using 6.1 Release - all patched, including packages with mtier.

I'm running a PHP56 web server, I am initiating automatic downloads using 
headers but whenever I download an image it cant be opened because no matter 
what image type it is I get:

Error interpreting JPEG image file (Not a JPEG file: starts with 0x0a 0xff)

I have been trying to figure this out all morning, I found a blog post which a 
guy has the exact same problem. 
https://shareithq.wordpress.com/tag/php-nginx-or-php-seems-to-be-adding-1-byte-to-image-files/

But I tested his fix on the file, and it works..

tail -c +2 avatest_local.jpg > avatest_fixed.jpg

Is it possible some sort of automatic compression is in use on the system? or 
is that just ridiculous?

Has anyone experienced this before and worked out the issue? Thanks
0x0a is a line feed (LF), and 0xFF looks like it is the start of the JPG image.

Does your PHP source file have a blank line at the top?

e.g.
[blank line]
<?php
// send image bytes
?>

i.e. your PHP source file has the 0x0a in it? If I'm right then that will be sent as part of the output (the first byte in fact - what you are seeing).

Just an idea!

Reply via email to