Question about uploading jpg images in IE. Some time ago I made a small program for uploading images. Today, some people say that jpg images cannot be uploaded. I tested it in Chrome and Firefox locally and found that the upload was normal. I asked him what time he used a small program to upload images. today someone said that jpg images cannot be uploaded. I tested it in Chrome and Firefox locally and found that the upload was normal. I asked him what browser he used. it turned out to be the window of the world, and there was 360 ...... I was sorry. I think, is it a problem with IE? So I tested it in IE. The original program is as follows:
Switch ($ type) {case "image/jpeg": $ resultImage = imagecreatefromjpeg ($ original); imagejpeg ($ resultImage, $ target, $ quality); break; case "image/png": $ resultImage = imagecreatefrompng ($ original); imagepng ($ resultImage, $ target, $ quality_png); break; case "image/gif ": $ resultImage = imagecreatefromgif ($ original); imagegif ($ resultImage, $ target, $ quality); break; default: die ("This file type is not supported"); exit ;}
Later, google found that jpg images are indeed different from IE images.
Upload a jpg image under IE and print the following information:
Array([name] => bkjia.jpg[type] => image/pjpeg[tmp_name] => /tmp/phprY0loE[error] => 0[size] => 71189)
The Mimetype of a jpg image is image/pjpeg. Because Chrome or Firefox is used in development, image/pjpeg is not added during the judgment, so jpg images cannot be recognized in IE kernel browsers.
The following is a comparison of the formats of images in different browsers:
firefox image/jpeg image/bmp image/gif image/pngie 6 image/pjpeg image/bmp image/gif image/x-pngie 7 image/pjpeg image/bmp image/gif image/x-pngie 8 image/pjpeg image/bmp image/gif image/x-png
When uploading images, ie translates jpg and jpeg files into image/pjpeg files and png files into image/x-png files. Firefox is very standard: jpg and jpeg are translated into image/jpeg, and png is translated into image/png.
The program is changed to OK.
Switch ($ type) {case "image/jpeg": $ resultImage = imagecreatefromjpeg ($ original); imagejpeg ($ resultImage, $ target, $ quality); break; case "image/pjpeg": $ resultImage = imagecreatefromjpeg ($ original); imagejpeg ($ resultImage, $ target, $ quality); break; case "image/png ": $ resultImage = hour ($ original); imagepng ($ resultImage, $ target, $ quality_png); break; case "image/gif": $ resultImage = imagecreatefromgif ($ original ); imagegif ($ resultImage, $ target, $ quality); break; default: die ("This file type is not supported"); exit ;}
Bytes. I tested it in Chrome and Firefox locally and found that the upload was normal. I asked him what he used...