Announcement

#1 2015-06-25 10:23:24

tomass
Member
New Zealand
2015-06-16
21

[resolved] Photo downloaded from my Piwigo seem corrupted: Not a JPEG file

Greetings,
First of all big thank you to the whole team for such a versatile and powerful product!

I ran into an issue with photo download function and I don't know what else to try and where else to look: I uploaded photos successfully into an album. When I download them back, EOG reports an error message and doesn't show the photo:

Code:

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

I can see that the downloaded photo is of identical size to the uploaded one. Also the filesize in photos/upload/2015/06/20/ is matching. In fact I can open that file directly just fine too. I captured headers using curl -D option both directly from Apache and when proxied via Nginx (The file issue seems identical in both scenarios).

Code:

curl -D header.txt -o picture.jpg "http://xxx.xxx.xxx.xxx/photos/action.php?id=1&part=e&download"

Direct from Apache:

Code:

HTTP/1.1 200 OK
Date: Wed, 24 Jun 2015 09:08:57 GMT
Server: Apache
X-Powered-By: PHP/5.5.9-1ubuntu4.9
Set-Cookie: pwg_id=kiu629svat1r9m8rjf5gd79o06; path=/photos/; HttpOnly
Expires: Wed, 24 Jun 2015 12:08:57 GMT
Cache-Control: public, max-age=10800
Last-Modified: Sat, 20 Jun 2015 08:39:10 GMT
Content-Length: 1426837
Content-Disposition: attachment; filename="150101_0029.jpg";
Content-Transfer-Encoding: binary
Content-Type: image/jpeg

Through Nginx as reverse proxy:

Code:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 24 Jun 2015 09:06:38 GMT
Content-Type: image/jpeg
Content-Length: 1426837
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.9
Set-Cookie: pwg_id=2rc3ns09b1gsp59gtcsc4ambh1; path=/photos/; HttpOnly
Expires: Wed, 24 Jun 2015 12:06:38 GMT
Cache-Control: public, max-age=10800
Last-Modified: Sat, 20 Jun 2015 08:39:10 GMT
Content-Disposition: attachment; filename="150101_0029.jpg";
Content-Transfer-Encoding: binary

The Content-Length in both cases seems correct. However when proxied, Nginx also throws following warning into its error log:

Code:

2015/06/24 21:28:47 [warn] 20#0: *4 upstream sent more data than specified in "Content-Length" header while reading upstream, client: 192.168.1.xxx, server: tomassobekphotography.co.nz, request: "GET /photos/action.php?id=2&part=e&download HTTP/1.1", upstream: "http://172.17.0.2:80/photos/action.php?id=2&part=e&download", host: "xxx.xxx.xxx.xxx", referrer: "http://xxx.xxx.xxx.xxx/photos/picture.php?/2/category/1"

I tried looking into action.php but not being a programmer and knowing next to nothing about PHP, I failed to notice anything suspicious. Could anyone point me in the right direction, please.

Piwigo version: 2.7.4
Operating system: Linux
PHP: 5.5.9-1ubuntu4.9 (Show info) [2015-06-25 20:09:23]
MySQL: 5.7.7-rc [2015-06-25 08:09:23]
Graphics Library: ImageMagick 6.7.7-10

Last edited by tomass (2015-06-26 11:14:03)

Offline

 

#2 2015-06-26 11:10:12

tomass
Member
New Zealand
2015-06-16
21

Re: [resolved] Photo downloaded from my Piwigo seem corrupted: Not a JPEG file

I managed to find the root cause. There were some extra white spaces in my config.inc.php as well as couple of files of my plugin log_failed_logins. I have now provided a fixed version of the plugin.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact