dekoh.portal.fwk.image
Class ResizeImageCache
java.lang.Object
dekoh.portal.fwk.image.ResizeImageCache
public class ResizeImageCache
- extends Object
ResizeImageCache manages the cached resized images for a given kind of DigitalObject. Only one instance
of this class is created per application, and this instance is kept in application scope (ServeletContext).
Instance of this class can be obtained by calling {@link
- Since:
- Jun 26, 2007
- See Also:
AbstractImageResizer
|
Method Summary |
protected File |
_getOrCreateResizeImageCache(ImageSize showImageSize,
int resizeImageId)
|
protected File |
createResizedImage(File originalFile,
File resizedImageDestination,
ImageSize resizeImageSize,
EXIFOrientation resizeImageExifOrientation,
DigitalObject digitalObject)
|
void |
destroy()
|
static void |
destroyResizer()
|
protected byte[] |
extractThumbNailFromMetadata(File originalFile)
|
protected File |
getOrCreateResizeCacheDirectory(ImageSize showImageSize,
DigitalObject digitalObject)
|
File |
getResizedImageFile(ImageSize imageSize,
DigitalObject digitalObject,
EXIFOrientation imageOrientation)
|
protected File |
getResizedImageFile(DigitalObject digitalObject,
File resizeCacheDir,
EXIFOrientation imageOrientation)
|
protected String |
getResizeImageName(DigitalObject digitalObject,
EXIFOrientation imageOrientation)
|
void |
resize(File originalFile,
File mediumFile,
File smallFile,
File sqFile,
EXIFOrientation resizeImageExifOrientation)
|
File |
resize(File originalFile,
ImageSize imageSize,
EXIFOrientation imageOrientation,
DigitalObject digitalObject)
Resizes the given image to medium,small,square_thumb. |
File |
resize(File originalFile,
ImageSize imageSize,
DigitalObject digitalObject)
Equvivalant to calling resize() with
EXIFOrientation.TOP_LEFT |
void |
resizeToSizes(File originalFile,
List imageSizes,
EXIFOrientation imageOrientation,
DigitalObject digitalObject)
Resizes the given original image to to the specified smaller sizes. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RESIZE_IMAGE_CACHE
public static final String RESIZE_IMAGE_CACHE
- See Also:
- Constant Field Values
cacheDirRoot
protected final File cacheDirRoot
WEB_INF_CACHE
public static final String WEB_INF_CACHE
- See Also:
- Constant Field Values
ResizeImageCache
public ResizeImageCache(File cacheDir)
ResizeImageCache
public ResizeImageCache()
resize
public final File resize(File originalFile,
ImageSize imageSize,
DigitalObject digitalObject)
throws IOException
- Equvivalant to calling
resize() with
EXIFOrientation.TOP_LEFT
- Throws:
IOException
resize
public final File resize(File originalFile,
ImageSize imageSize,
EXIFOrientation imageOrientation,
DigitalObject digitalObject)
throws IOException
- Resizes the given image to
medium,small,square_thumb.
- Parameters:
originalFile - cannot be null and must point to an existing fileimageSize - imageOrientation - digitalObject -
- Returns:
-
- Throws:
IOException - when directory to contain resized images of given size could not be created, or the
generated resized image could not be saved to disc. (unrecoverable)
FileNotFoundException - when originalFile does not exist- See Also:
ImageResizer
resizeToSizes
public void resizeToSizes(File originalFile,
List imageSizes,
EXIFOrientation imageOrientation,
DigitalObject digitalObject)
throws IOException
- Resizes the given original image to to the specified smaller sizes. This resizing is incremental, Original >
Medium > Small > Squre Thumb etc.
- Parameters:
originalFile - imageSizes - must be ordered such that the largest size comes first. if this list is null or empty
this method will be a no-opimageOrientation - digitalObject -
- Throws:
IOException
getResizedImageFile
public File getResizedImageFile(ImageSize imageSize,
DigitalObject digitalObject,
EXIFOrientation imageOrientation)
throws IOException
- Throws:
IOException
getResizedImageFile
protected File getResizedImageFile(DigitalObject digitalObject,
File resizeCacheDir,
EXIFOrientation imageOrientation)
getResizeImageName
protected String getResizeImageName(DigitalObject digitalObject,
EXIFOrientation imageOrientation)
getOrCreateResizeCacheDirectory
protected File getOrCreateResizeCacheDirectory(ImageSize showImageSize,
DigitalObject digitalObject)
throws IOException
- Throws:
IOException
_getOrCreateResizeImageCache
protected final File _getOrCreateResizeImageCache(ImageSize showImageSize,
int resizeImageId)
throws IOException
- Throws:
IOException
extractThumbNailFromMetadata
protected byte[] extractThumbNailFromMetadata(File originalFile)
createResizedImage
protected File createResizedImage(File originalFile,
File resizedImageDestination,
ImageSize resizeImageSize,
EXIFOrientation resizeImageExifOrientation,
DigitalObject digitalObject)
throws IOException
- Throws:
IOException
resize
public void resize(File originalFile,
File mediumFile,
File smallFile,
File sqFile,
EXIFOrientation resizeImageExifOrientation)
throws IOException
- Throws:
IOException
destroy
public void destroy()
throws IOException
- Throws:
IOException
destroyResizer
public static void destroyResizer()
throws IOException
- Throws:
IOException
© 2009 Pramati Technologies - Dekoh - Portal for Developers