Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
1.11/5 (2 votes)
See more:
I want to an insert image onto mysql database and i tried but some images that are less than 100kb are inserting and another are are not insertig so can any body help from getriding from this problem...........plz can any body send the code in jsp for the above plzzzzzzzzzz
Wendelius 4-Jan-12 13:19pm    
Are you getting an error message and if you are, what it is?

You can reduce the size of the image by compressing it using some lostless or lossy algorithm of compression. JPEG is lossy, for example. If your image is already compressed using lossy compression, you can improve compression factor at the expense of lower image quality. At moderate degrees of lower quality you might not notice any defects, but further "improvements" of compression will make an image really ugly.

Important! Never edit compressed image! By doing it, you can degrade image even without increase in the compression factor, just because of several save operations accumulating defects. Keep uncompressed image, or, better, an image using lostless compression and always start conversion to JPEG or lossy PNG from this non-compromised sample.

[EDIT] Code is irrelevant here. You can have an image compression code, but this can be quite a big work.


Share this answer
Monjurul Habib 4-Jan-12 12:47pm    
good explanation, 5!
Sergey Alexandrovich Kryukov 4-Jan-12 12:50pm    
Thank you, Monjurul.
Espen Harlinn 4-Jan-12 16:25pm    
Sergey Alexandrovich Kryukov 4-Jan-12 18:51pm    
Thank you, Espen.
use blob as a datatype for inserting image if you are trying to save image direct into db
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900