Mercurial > hg > digilib-old
changeset 302:3baaf11898d2
Servlet version 1.5.1b
- new option "mo=jpg" to always send JPG (even from TIFF)
author | robcast |
---|---|
date | Sun, 24 Oct 2004 23:03:14 +0200 |
parents | 0ddfc57a79af |
children | 9db80eb0f50b |
files | servlet/src/digilib/servlet/DigilibImageWorker.java |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/DigilibImageWorker.java Sun Oct 24 20:23:50 2004 +0200 +++ b/servlet/src/digilib/servlet/DigilibImageWorker.java Sun Oct 24 23:03:14 2004 +0200 @@ -38,7 +38,7 @@ * */ public class DigilibImageWorker extends DigilibWorker { - + private DigilibConfiguration dlConfig; HttpServletResponse response; @@ -81,6 +81,8 @@ boolean wholeRotArea; + private boolean forceJPEG; + /** * @param dlConfig * @param response @@ -98,6 +100,7 @@ * @param innerUserImgArea * @param minSubsample * @param wholeRotArea + * @param forceJPEG */ public DigilibImageWorker(DigilibConfiguration dlConfig, HttpServletResponse response, String mimeType, int scaleQual, @@ -105,7 +108,7 @@ float paramBRGT, float[] paramRGBM, float[] paramRGBA, ImageFile fileToLoad, float scaleXY, Rectangle2D outerUserImgArea, Rectangle2D innerUserImgArea, float minSubsample, - boolean wholeRotArea) { + boolean wholeRotArea, boolean forceJPEG) { super(); this.dlConfig = dlConfig; this.response = response; @@ -123,6 +126,7 @@ this.innerUserImgArea = innerUserImgArea; this.minSubsample = minSubsample; this.wholeRotArea = wholeRotArea; + this.forceJPEG = forceJPEG; } /* @@ -244,7 +248,9 @@ // setup output -- if source is JPG then dest will be JPG else it's // PNG - if (mimeType.equals("image/jpeg") || mimeType.equals("image/jp2")) { + if (forceJPEG + || (mimeType.equals("image/jpeg") || mimeType + .equals("image/jp2"))) { mimeType = "image/jpeg"; } else { mimeType = "image/png"; @@ -254,7 +260,7 @@ // write the image docuImage.writeImage(mimeType, response.getOutputStream()); response.flushBuffer(); - + logger.info("image worker " + this.getName() + " done in " + (System.currentTimeMillis() - startTime));