Hello All, I have a file server that has all my picture for an application (user uploaded) and I have created a servlet that gets them from the file server and returns an array of bytes with the MIME type image. It all works great, but is kinda slow because the images are like 2500x2500 pixles, and in some cases the user is viewing 50+ of them.
I was wondering if there was a good way to scale the images (using the array of bytes) in the servlet and then pass it a parameter as to which image to get, large or thumb.
I have coded the solution below, but it is slower than the original I think... Any help would be great. Thanks, Matt
Also, does this solution require that the server have a graphics card because it is dealing with the Graphics object? [ October 24, 2005: Message edited by: matt eggbeers ]
- Another option is for each image, store a full size and a thumb. Then you don't need this resizing logic in the download request. It might seems less elegant that dynamcally resizing on demand - but perforamnce here is the critical factor.
Hope this helps. [ October 25, 2005: Message edited by: James Clinton ]
I agree in part, as the file is uploaded, crate the thumbnail and save it at the same time. Thumbnails are small and disk space is cheap I don't like the idea of doing this in Java though, there are applications that handle scaling much better.
Also, does this solution require that the server have a graphics card because it is dealing with the Graphics object? Nope, but you may want to search the Servlet forum for the word 'headless' to see the solution to some of the problems you'll run into, and their solutions. (headless refers to a Lunix box installed without a graphical interface)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com