简体   繁体   中英

How to change a type (mime type) of the image?

When I upload an image to FB, it has image/png type (or image/gif). But when I download back my uploaded image it has image/jpeg type already. How to change types? Is it just enough to save the image with different extension? I'v tried and it works, but is it the right way?

Is it just enough to save the image with different extension?

Only if the file type detection code is broken. If it only checks the extension then sure, this will fool it. If it, you know, actually looks at the file contents then no, this won't help; you'd have to use something like ImageMagick's convert to transcode the image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM