jsp smart upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jesmee
    New Member
    • Jan 2010
    • 2

    #1

    jsp smart upload

    hello,

    i need the code that uploads the image file of specific size from smart upload. If the file that has more size with the limited size is uploaded, the code must trim the size of file to the limited and specific size.Please help me for this code.

    thanks in advance
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    You need to write the code yourself. But we will help you if you list the code here and show us where you are stuck.
    You need following knowledge/code:
    - a HTML-page with an upload-button on it.
    - a Java-Servlet which gets the uploaded data and saves it as image file.

    This servlet detects the image format according to the MIME type and file extension. Then it creates an image-object of this format from the upload-data. Then it converts the various source formats (for example bmp, gif, tif, png) to a single destination format. A suitable image-conversion library should make this task easy. The best destination format is jpg, because it can be easily reduced further on and is small by itself. If the file size of the converted picture is still too big, then it can be reduced by either saving the picture with lower jpg-quality or, more effectively, by reducing the canvas size. (e.g. from 1000x1000 to 500x500) before saving.

    Comment

    Working...