Upload fails with (some) JPG images #778
-
Recently I've updated from 0.8.17 to 0.8.19. Then I tried to upload a .jpg file, e.g. this example file. The result was this message
In other cases, i.e. other Webpsace with Yellow 0.8.19 asswell, I got the notice
in the logfile. I have the impression that the origin of this behavior is
and for the others
Perhaps that's the reason of the different reactions. To reproduce the issue please use the example file linked above. I'd appreciate it if my contribution helps to improve Yellow. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I can confirm the error using the provided image file. To complete the report, here is the appropriate message from apache error log (anonymiced paths and IP addresses).
|
Beta Was this translation helpful? Give feedback.
-
If the problem is in the detection of the image dimensions, some time ago I wrote a simple Lua procedure that works well with the file shared in Dropbox: elseif sig:match('^\255\216') then -- JPEG
--[[
The strategy is
1. Loop through the markers and their lengths
2. When a SOF marker is found, read the dimensions
]]
img_type = 'jpeg'
file:seek('set', 2)
while true do
local start, marker, len = ('B B >I2'):unpack(file:read(4))
assert(start == 255)
if marker == 192 or marker == 194 then
height, width = ('x >I2 I2'):unpack(file:read(5)) -- x = n of bits of the colour values
break
end
file:seek('cur', len-2)
end Now I do not remember the details, but when I have some time I can compare this logic with the one in core.php:3283. |
Beta Was this translation helpful? Give feedback.
-
Thanks everyone for investigating the problem. An update to the image detection code has just been published and is available in latest Core extension. The old code detected a DHT marker as SOF marker (start of frame), only SOF markers contain image dimensions. Please give it a try and let us know should you still have problems. |
Beta Was this translation helpful? Give feedback.
Thanks everyone for investigating the problem. An update to the image detection code has just been published and is available in latest Core extension. The old code detected a DHT marker as SOF marker (start of frame), only SOF markers contain image dimensions.
Please give it a try and let us know should you still have problems.