简体   繁体   中英

Java webapp image file upload best practice

I am building a webapp which needs to support image files upload. The file format we are supporting is JPG/JPEG/GIF/PNG.

Now comes the question, I can store the file format in their own format at server folder, like:

  1. a.jpg
  2. b.jpeg
  3. c.gif
  4. d.png

Or I can convert all file format to PNG file at server side, like:

  1. a.png
  2. b.png
  3. c.png
  4. d.png

Which way is the better choice? Please help me to verify.

Thank you for you time! George

It depends on what you want to do with the images.

If you are going to do some image manipulation then you may benefit from the conversion to one specific format.

If the conversion logic for the formats are already readily available via library (which should be the case for these formats.)

Otherwise if you are just serving those files back, without manipulation there there's no point of going through the conversion overhead.

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