I have a page that takes an image, uploads it to my server, processes it, and then redisplays it to the user. This page works completely fine with any image, jpg, jpeg, or png, and I even got it to work with images taken with the 'take a photo' option on mobile. But there seems to be one last test case I cant get to work, which is photos that I took on my DSLR and saved off of the SD card onto my computer.
Is there anything in particular that is different about these images that I have to handle differently? Perhaps something in the exif data? They upload just fine, and they are not any bigger than other high quality pictures uploaded, such as the 'take a photo' ones (I am downsampling them to get all pictures at a max of ~1mb if that matters, and I adjusted my nginx to allow uploads of up to 50mb). If I redownload them from my server, they open just fine, so I know that the image is not corrupted in any way.
Anyone have any insight? If you need any of my code / conf files I am happy to edit them into this post.
I assume you are referring display as showing images in browser because nginx does not have any display abilities.
Please take a look at extensions. It is highly possible that DSLR names them as .JPEG or .JPG and most probably all others are .jpg or .jpeg.
Try same extension writing with working ones.
The problem underlying here is MIME types definitions. Your nginx configuration should have mime.types file which has types {} block.
If nginx does not see suitable MIME type for your extension, it uses "application/octet-stream" which is not a viewable MIME type for browsers.
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
}
This is an example of type block which you can see clearly .jpeg and .jpg are defined as image/jpeg not .JPEG.