122
|
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 */
|
149
|
21
|
122
|
22 package digilib.image;
|
|
23
|
|
24 import java.io.IOException;
|
|
25
|
159
|
26 import digilib.io.ImageFile;
|
122
|
27 import digilib.io.FileOps;
|
|
28
|
|
29 /**
|
|
30 * @author casties
|
|
31 *
|
|
32 */
|
|
33 public class ImageLoaderDocuInfo implements DocuInfo {
|
|
34
|
|
35 private ImageLoaderDocuImage img = new ImageLoaderDocuImage();
|
|
36
|
159
|
37 /* check image size and type and store in ImageFile f */
|
|
38 public boolean checkFile(ImageFile f) throws IOException {
|
149
|
39 ImageLoaderDocuImage img = new ImageLoaderDocuImage();
|
|
40 img.preloadImage(f);
|
|
41 img.reader = img.reader;
|
|
42 ImageSize d =
|
|
43 new ImageSize(img.reader.getWidth(0), img.reader.getHeight(0));
|
122
|
44 f.setSize(d);
|
|
45 String t = img.reader.getFormatName();
|
|
46 t = FileOps.mimeForFile(f.getFile());
|
|
47 f.setMimetype(t);
|
148
|
48 // clean up
|
149
|
49 //img.reader.reset();
|
148
|
50 //img.reader = null;
|
122
|
51 return true;
|
|
52 }
|
|
53
|
|
54 }
|