| Joshua Cranmer 2007-08-26, 7:19 pm |
| lovaspillando wrote:
> Hi:
Please don't multi-post. If you must post to two newsgroups, specify
both newsgroups in your news client /at the same time/.
>
> I have a web application in asp.net wich I am rewriting to Java. Is
> about uploading pictures online. Web system upload perfectly
> pictures, but in original size. I would like to upload too a thumbail
> version of the big picture. For that, I am using Jpegencoder from
> sun, and seems I am doing something bad, coz when I am trying to do
> that I get a exception: "nof a jpeg file: start " and so on...
If it's not a JPEG, using a JPEG to decode won't work.
> I get the file data from a fileupload (apache commons fileupload), and
> since I get the byte array of each picture I save it into a bussiness
> object.
>
> The complete code is in here, just in case someone of you could help
> me. I am getting extressed coz dont know what coulb be wrong, if
> somone of you could help it will be more than great!. Thank you for
> your help!
This is Usenet, not an instant-messaging forum or a text-message. Take
time and care to ensure that your words are spelled correctly and that
proper capitalization is used (especially where class names are involved).
I would also note that the code you have given us is obviously not
complete; it is generally more important to give relevant portions of
code and highlighting where the error is.
> [ ... ]
> JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(in);
Are you sure that the input stream is actually a JPEG? Print it out
somewhere and see if it really is a JPEG.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
|