public class WebEnabledImageCreator
extends java.lang.Object
WebEnabledImageCreator class provides all functionality in
order to create a web enabled image.| Constructor and Description |
|---|
WebEnabledImageCreator(Asset asset,
MimeTypeService mimeTypeService) |
| Modifier and Type | Method and Description |
|---|---|
void |
create(java.awt.image.BufferedImage image,
java.lang.String defaultMimetype,
java.lang.String dimensions,
java.lang.String keepFormat,
java.lang.String qualityStr,
boolean force)
This method creates the web enabled rendition.
|
protected Layer |
createImage(java.awt.image.BufferedImage image,
int maxWidth,
int maxHeight)
A image with the given
maxWith and maxHeight
is generated out if the image source. |
protected java.lang.Integer[] |
getDimension(java.lang.String dimensions) |
protected java.lang.String |
getExtension(java.lang.String mimetype) |
protected java.lang.String |
getMimeType(Asset asset) |
protected double |
getQuality(double base,
java.lang.String qualityStr) |
protected void |
saveImage(Asset asset,
Layer layer,
java.lang.String mimetype,
double quality,
java.lang.String renditionName) |
public WebEnabledImageCreator(Asset asset, MimeTypeService mimeTypeService)
public void create(java.awt.image.BufferedImage image,
java.lang.String defaultMimetype,
java.lang.String dimensions,
java.lang.String keepFormat,
java.lang.String qualityStr,
boolean force)
throws RepositoryException,
java.io.IOException
force
param is set to false than following check is executed:
check if layer has to persisted. in case the layer is still equal
than the ori file can be taken (save space).image - buffered image used to create web enabled imagedefaultMimetype - default output mimetypedimensions - comma separated string containing max. with, max. heightkeepFormat - contains all mimetypes that should be kept (instead of using the default mimetype)qualityStr - image quality in percentforce - if true than the webenabled image is always created
nevertheless the ori image is smaller than the requested image dimensionsRepositoryException - in case the web rendition could not be persistedjava.io.IOException - while processing the imageprotected void saveImage(Asset asset, Layer layer, java.lang.String mimetype, double quality, java.lang.String renditionName) throws java.io.IOException
java.io.IOExceptionprotected Layer createImage(java.awt.image.BufferedImage image, int maxWidth, int maxHeight)
maxWith and maxHeight
is generated out if the image source.image - image sourcemaxWidth - max. thumbnail widthmaxHeight - max. thumbnail heightprotected java.lang.String getExtension(java.lang.String mimetype)
protected java.lang.String getMimeType(Asset asset)
protected java.lang.Integer[] getDimension(java.lang.String dimensions)
protected double getQuality(double base,
java.lang.String qualityStr)