comparison servlet/src/digilib/image/ImageLoaderDocuInfo.java @ 122:a32e8c80e2f2

Servlet Version 1.10b1 - more intelligent handling of resolutions - different handling of mo=lores
author robcast
date Wed, 11 Jun 2003 22:51:28 +0200
parents
children 837a633a0407
comparison
equal deleted inserted replaced
121:1ac2c5c6ec0e 122:a32e8c80e2f2
1 /* ImageLoaderDocuInfo -- DocuInfo implementation using ImageLoader API
2
3 Digital Image Library servlet components
4
5 Copyright (C) 2003 Robert Casties (robcast@mail.berlios.de)
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11
12 Please read license.txt for the full details. A copy of the GPL
13 may be found at http://www.gnu.org/copyleft/lgpl.html
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 * Created on 11.06.2003
20 *
21 */
22 package digilib.image;
23
24 import java.awt.Dimension;
25 import java.io.IOException;
26
27 import digilib.io.DocuFile;
28 import digilib.io.FileOps;
29
30 /**
31 * @author casties
32 *
33 */
34 public class ImageLoaderDocuInfo implements DocuInfo {
35
36 private ImageLoaderDocuImage img = new ImageLoaderDocuImage();
37
38 /* check image size and type and store in DocuFile f */
39 public boolean checkFile(DocuFile f) throws IOException {
40 // see if f is already loaded
41 if ((img.reader == null) || (img.imgFile != f.getFile())) {
42 img.preloadImage(f.getFile());
43 }
44 Dimension d =
45 new Dimension(img.reader.getWidth(0), img.reader.getHeight(0));
46 f.setSize(d);
47 String t = img.reader.getFormatName();
48 t = FileOps.mimeForFile(f.getFile());
49 f.setMimetype(t);
50 f.setChecked(true);
51 return true;
52 }
53
54 }