I just was able to upload 10Mb image. It can be some limitation in the code
you're using, for example Java array can not exceed 2147483647 bytes. So, if
you code uses memory buffering with only one buffer you can meet this limit.
Dmitry.
----- Original Message -----
From: "Bruce Scharlau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 02, 1999 7:12 AM
Subject: image size limits
> Has anyone had any experience with size limitations on images?
>
> I'm working on an application which
> 1) uploads an image to a server,
> 2) tells the user the filename, size, and such, and afer it is uploaded,
> provides a thumbnail of
> the image.
> All of the details are then put entered into an Access DB by another
> servlet.
>
> If I upload images above 50k they don't appear in IE5, and Netscape 4.5
> won't take anything above 5k, although it's happy to display the ones
> uploaded in IE5. I'm aiming to eventually upload 20-30MB images.
> I'm using Jason Hunter's multipartrequest for the upload, and a modified
> version of his ShrinkFilter (see the code for this below).
>
> Do I need to integrate some sort of buffer when calling the ShrinkFilter
> images?
> Or is there something else I'm missing?
>
> Cheers
> Bruce
>
> The ShrinkFilter code:
> // servlet filter chain to shrink image
> // derived from example in Hunter, 177, (thanks Jason!)
>
> import java.awt.*;
> import java.awt.image.*;
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> import Acme.JPM.Encoders.GifEncoder;
>
> public class ShrinkFilter extends HttpServlet {
> Frame frame = null;
> Graphics g = null;
>
> public void init (ServletConfig config) throws ServletException {
> super.init(config);
> frame = new Frame();
> frame.addNotify();
> }
>
> public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException {
>
> ServletOutputStream out = res.getOutputStream(); // binary output
> try {
>
> String desiredGIF = req.getPathTranslated();
> if (desiredGIF == null) {
> throw new ServletException("Extra path information " +
> "must point to an image");
> }
>
> // Load the image, so we can get a true width and height
> MediaTracker mt = new MediaTracker(frame);
> // create an image out of them
> Image image = Toolkit.getDefaultToolkit().getImage(desiredGIF);
> mt.addImage(image, 0);
> try {
> mt.waitForAll();
> } catch (InterruptedException e) {
> getServletContext().log(e, "Interrupted while loading image");
> throw new ServletException(e.getMessage());
> }
>
> // construct off-screen image
> int w = image.getWidth(frame);
> int h = image.getHeight(frame);
> Image offscreen = frame.createImage(w,h);
> g = offscreen.getGraphics();
>
> // draw image to off-screen graphics context
> g.drawImage(image, 0,0, frame);
> g.setFont(new Font("Monospaced", Font.BOLD, 40));
> g.drawString("XXX", 10, 40);
>
>
> // shrink the image so that half its width and half its height
> // improved version would get desired ratios in its init parameters
> // could also resize using ReplicateScaleFilter or
> // AreaAveragingScaleFilter.
>
> Image shrunk = offscreen.getScaledInstance(offscreen.getWidth(frame)/
4,
> offscreen.getHeight(frame)/ 4,
> offscreen.SCALE_DEFAULT);
>
>
> // Encode and return the shrunken image
> res.setContentType("image/gif");
> GifEncoder encoder = new GifEncoder(shrunk, out);
> // GifEncoder encoder = new GifEncoder(offscreen, out);
> encoder.encode();
> } finally {
> if (g != null) g.dispose();
> }
> }
> public void destroy() {
> // clean up resources
> if (frame != null) frame.removeNotify();
> }
> }
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html