|
|
|
|
@ -29,18 +29,18 @@ public final class ImagesServlet extends HttpServlet
|
|
|
|
|
{
|
|
|
|
|
Integer id = new Integer(param);
|
|
|
|
|
Image img = new ImageDAO().getImageForID( id );
|
|
|
|
|
int width = img.getWidth( null );
|
|
|
|
|
int height = img.getHeight( null );
|
|
|
|
|
double wrel = ((double)width ) / MAX_WIDTH;
|
|
|
|
|
double hrel = ((double)height ) / MAX_HEIGHT;
|
|
|
|
|
if( wrel > 1 && wrel > hrel )
|
|
|
|
|
{
|
|
|
|
|
img = img.getScaledInstance( MAX_WIDTH, -1, Image.SCALE_FAST );
|
|
|
|
|
}
|
|
|
|
|
else if( hrel > 1 && hrel > wrel )
|
|
|
|
|
{
|
|
|
|
|
img = img.getScaledInstance( -1, MAX_HEIGHT, Image.SCALE_FAST );
|
|
|
|
|
}
|
|
|
|
|
// int width = img.getWidth( null );
|
|
|
|
|
// int height = img.getHeight( null );
|
|
|
|
|
// double wrel = ((double)width ) / MAX_WIDTH;
|
|
|
|
|
// double hrel = ((double)height ) / MAX_HEIGHT;
|
|
|
|
|
// if( wrel > 1 && wrel > hrel )
|
|
|
|
|
// {
|
|
|
|
|
// img = img.getScaledInstance( MAX_WIDTH, -1, Image.SCALE_FAST );
|
|
|
|
|
// }
|
|
|
|
|
// else if( hrel > 1 && hrel > wrel )
|
|
|
|
|
// {
|
|
|
|
|
// img = img.getScaledInstance( -1, MAX_HEIGHT, Image.SCALE_FAST );
|
|
|
|
|
// }
|
|
|
|
|
out.write( img.getImageData() );
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
|