Erroneous error message when photo files too large
Been meaning to flag this but keep forgetting, but it just happened again so here I am.
When uploading an image file (jpg in my case) that exceeds the site's size limit (5 MB? not sure), the error dialog says "content of the file does not match the extension", which is clearly nonsense, it's just too large. I edit the file to decrease its size, and then it uploads.
It would be great if the error message said instead, the file is too large. Thanks!
Thanks Ray, got your email. I haven't kept track of just which images this has occurred with (it has been at least 20 times), and once I edit them (I don't resize, I just crop the edges a tiny bit) they no longer trigger the error. So I don't have the original from this most recent time (I overwrite with the cropped image).
It occurred to me that it may be restricted to photos I take in Panorama mode on my Android. I just took a couple and am now going to try to upload right here as an experiment.
*drum roll please*
And sure enough, both of them got the error message. One file was 12 MB, the other 7MB. I screengrabbed:
Now I shall do the teeny-tiny crop job, trimming the barest bit. BTW I do the cropping in the Windows built-in simple image editor, I don't open a program to do it. Now the file sizes are 7.5 and 4.2 MB respectively (even removing an unnoticeably thin sliver results in that much reduction).
*second drumroll*
And they both work fine. Here they are, larger one first. Note that the larger one is still larger than the smaller one's original size (7.5 vs 7) and it uploads fine. This tells me that it might have something to do with some kind of meta info embedded in the pano that gets stripped out when any editing is done...
Ray, I just emailed you these originals. Hope this helps.
Mystery solved. The issue is that the images being generated do not specify the specific image format (JFIF / JPEG File Interchange Format).
It only shows the EXIF (Exchangeable image file format) part. Which is used by just about all images. JPG, TIF, WAV, PNG, and WEBP.
So when uploaded, the software sees the JPG extension, then looks for the JFIF encoding at the start of the image file and does not find it.
And throws an errors.
For sure the images are not encoded incorrectly as all my image editors and viewers can open theme and understand they are JPEGs.
The issue is that the forum software is not aware of the "panoramic" images and how they are encoded. I will see if I can fix that.
By example: you can see in the HEX dump that the start of the original does not have the "JFIF" part (which is what the forum software is looking for).
But when I fix that, by just opening in an editor and saving, it now contains the "JFIF" part. And will upload fine.
Retired, living in Western Mass. Enjoy music, cooking and my family.
Current cookers Weber Spirit 3 burner with a full insert griddle added. A 22" Kettle with vortex, SnS and a Smokey Joe. The most recent addition is a Pit Barrel Jr with bird hanger, 4 hooks and cover. ThermoWorks Smoke 2 probe, DOT, 2 ThermoPops and a Thermapen MK4. A Thermoworks RFX Gateway 2 probe meat thermometer.
I don't know if this is related. When I take a picture with my phone the extension is .heic. If I attempt to upload an error occurs. Basically saying an invalid format. All I do is edit/crop and it is .jpg., it now uploads. No big deal as I normally do some cropping prior to uploading.
Update. I started to think this was a real bug in the code.
I hunted for the code the checks this and, for JPEG, it only looks at the first 2 and the last 2 bytes
The first 2 bytes will be FFD8 for JPEG. And both the original and the fixed version have that. I thought it would key on the entire code (6 to 24 bytes) that contains the JFIF text, but not so.
The last two bytes will be FFD9 for JPEG. Those exists on the fixed version, but not the original.
Panoramic JPEG files end in 4 bytes (53454654) (which just spells SEFT).
So the real issue is that the code is not aware of the Panoramic file format or the correct ending bytes.
I have added a little hack to remedy that issue. If the test for JPEG fails for the normal ending bytes, it then checks for the panoramic ending bytes.
Retired, living in Western Mass. Enjoy music, cooking and my family.
Current cookers Weber Spirit 3 burner with a full insert griddle added. A 22" Kettle with vortex, SnS and a Smokey Joe. The most recent addition is a Pit Barrel Jr with bird hanger, 4 hooks and cover. ThermoWorks Smoke 2 probe, DOT, 2 ThermoPops and a Thermapen MK4. A Thermoworks RFX Gateway 2 probe meat thermometer.
raywjohnson I assume you have referencing my post. If so, I tried again and the same error occurs. IThanks and don't worry about it. As I said a simple crop converts to a valid format.
On another note, I could have missed it but have you always been in Thailand?
Great job raywjohnson When I read the first post I immediately thought of this issue. My software company wrote the file control software for the federal judiciary and we never even looked at extensions but at the information embedded in the file itself to determine its type, and if marked classified or restricted we changed the file so no other software could open or print the file except through our software. Again, a good job locating the problem.
Retired, living in Western Mass. Enjoy music, cooking and my family.
Current cookers Weber Spirit 3 burner with a full insert griddle added. A 22" Kettle with vortex, SnS and a Smokey Joe. The most recent addition is a Pit Barrel Jr with bird hanger, 4 hooks and cover. ThermoWorks Smoke 2 probe, DOT, 2 ThermoPops and a Thermapen MK4. A Thermoworks RFX Gateway 2 probe meat thermometer.
On iOS/iPadOS you can go to Settings>Camera>Formats and set it to Most Compatible. That saves pictures as JPEG, but some stuff won't work and they'll take up more space than HEIC, but if it's worth it to you to avoid the hassle it might be worth it.
Only the Safari browser can display HEIC files (according to Wikipedia: As of September 2023, only Safari supports HEIC format natively). And only about 18% of users run Safari. So the other 80% would not be able to see your images.
Retired, living in Western Mass. Enjoy music, cooking and my family.
Current cookers Weber Spirit 3 burner with a full insert griddle added. A 22" Kettle with vortex, SnS and a Smokey Joe. The most recent addition is a Pit Barrel Jr with bird hanger, 4 hooks and cover. ThermoWorks Smoke 2 probe, DOT, 2 ThermoPops and a Thermapen MK4. A Thermoworks RFX Gateway 2 probe meat thermometer.
raywjohnson a follow up. I went into the camera app setting. There's an option to make the format high efficiency which was enabled. It also noted it wasn't compatible with all web sites and platforms. I turned it off, took a picture and sure enough it was jpg format. Im not sure how it got enabled. 🙄
Thank you for this!!! I’ve always been frustrated that anytime I air drop pictures to my mac I have to do through extra steps to get them to jpeg that can be emailed. I just changed my settings too.
Comment