Class ThumbnailTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- com.jalios.jcms.taglib.ThumbnailTag
-
- All Implemented Interfaces:
JcmsConstants
,JaliosConstants
,java.io.Serializable
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
public class ThumbnailTag extends javax.servlet.jsp.tagext.BodyTagSupport implements JcmsConstants
This tags add possibily to create and display a thumbnail of an image. If you need to create and display a thumbnail from java code. Use methodcreateThumbnail(FileDocument, File, URL, ImageFormat, int, int)
which use same internal cache.- Since:
- jcms-5.5.0
- Version:
- $Revision: 134361 $
- Author:
- Olivier Jaquemet
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ImageFormat
DEFAULT_FORMAT
static java.lang.String
DEFAULT_FORMAT_PROPERTY
static java.lang.String
LAZY_LOADING_ENABLED_PROPERTY
static int
MAX_THUMB_SIZE
static int
MIN_THUMB_SIZE
static java.lang.String
REVISION
-
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
-
-
Constructor Summary
Constructors Constructor Description ThumbnailTag()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.io.File
buildThumbnail(java.io.File srcFile, int width, int height, java.io.File defaultFile, java.lang.String background)
Returns a Thumbnail for the given path.static java.lang.String
buildThumbnail(java.lang.String path, int width, int height, java.lang.String defaultPath)
static java.lang.String
buildThumbnail(java.lang.String path, int width, int height, java.lang.String defaultPath, java.lang.String background)
Returns a Thumbnail for the given path.protected void
clean()
static boolean
createImageThumbnail(java.io.File imageFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight)
static boolean
createImageThumbnail(java.io.File imageFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background)
This method creates a thumbnail of the given image source file.static boolean
createImageThumbnail(java.io.File imageFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
This method creates a thumbnail of the given image source file.static boolean
createOpenOfficeThumbnail(java.io.File docFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
This method creates a thumbnail of the given Open Office file.static boolean
createOpenXmlThumbnail(java.io.File docFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
This method creates a thumbnail of the given OpenXml file.static java.io.File
createThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight)
static java.io.File
createThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background)
Create a thumbnail using the first valid source from FileDocument, File or URL using given dimensions.static java.io.File
createThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
Create a thumbnail using the first valid source from FileDocument, File or URL using given dimensions.static java.lang.String
createThumbnailFromSessionAttribute(java.lang.String sessionAttrName)
static boolean
createThumbnailNow(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.io.File destFile)
static boolean
createThumbnailNow(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.io.File destFile, java.lang.String background)
This method create a thumbnail of one of the three source given using the options passed as parameters ("now" as opposed to generation when going through ajax}.static boolean
createThumbnailNow(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.io.File destFile, java.lang.String background, boolean square)
This method create a thumbnail of one of the three source given using the options passed as parameters ("now" as opposed to generation when going through ajax}.int
doAfterBody()
int
doEndTag()
int
doStartTag()
static java.io.File
getThumbnailFile(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, int maxWidth, int maxHeight)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions.static java.io.File
getThumbnailFile(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, int maxWidth, int maxHeight, boolean square)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions.static java.io.File
getThumbnailFile(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, int maxWidth, int maxHeight, boolean square, java.lang.String extension)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions.static void
invalidateCacheAttemptThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url)
Invalidates the cache of failure while attempt to create a thumbnail for the given parameter.void
setAddChannelBaseUrl(boolean addChannelBaseUrl)
void
setAjaxLoadingImage(java.lang.String ajaxLoadingImage)
void
setAlt(java.lang.String alt)
void
setBackground(java.lang.String background)
void
setCss(java.lang.String css)
void
setData(Data data)
void
setDataAttribute(DataAttribute dataAttribute)
void
setDestination(java.lang.String path)
void
setFile(java.io.File file)
void
setFileDoc(FileDocument fd)
void
setForceUpdate(boolean forceUpdate)
void
setFormat(java.lang.String format)
void
setHeight(int height)
void
setHtmlAttributes(java.lang.String htmlAttributes)
void
setPath(java.lang.String path)
void
setSquare(boolean square)
void
setUrl(java.lang.String purl)
void
setUseAjaxLoading(boolean useAjaxLoading)
void
setWidth(int width)
-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
MAX_THUMB_SIZE
public static final int MAX_THUMB_SIZE
- See Also:
- Constant Field Values
-
MIN_THUMB_SIZE
public static final int MIN_THUMB_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_FORMAT
public static final ImageFormat DEFAULT_FORMAT
-
DEFAULT_FORMAT_PROPERTY
public static final java.lang.String DEFAULT_FORMAT_PROPERTY
- See Also:
- Constant Field Values
-
LAZY_LOADING_ENABLED_PROPERTY
public static final java.lang.String LAZY_LOADING_ENABLED_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
clean
protected void clean()
-
setData
public void setData(Data data)
-
setFileDoc
public void setFileDoc(FileDocument fd)
-
setFile
public void setFile(java.io.File file)
-
setPath
public void setPath(java.lang.String path)
-
setUrl
public void setUrl(java.lang.String purl)
-
setFormat
public void setFormat(java.lang.String format)
-
setWidth
public void setWidth(int width)
-
setHeight
public void setHeight(int height)
-
setDestination
public void setDestination(java.lang.String path)
-
setBackground
public void setBackground(java.lang.String background)
-
setSquare
public void setSquare(boolean square)
-
setForceUpdate
public void setForceUpdate(boolean forceUpdate)
-
setAlt
public void setAlt(java.lang.String alt)
-
setCss
public void setCss(java.lang.String css)
-
setHtmlAttributes
public void setHtmlAttributes(java.lang.String htmlAttributes)
-
setUseAjaxLoading
public void setUseAjaxLoading(boolean useAjaxLoading)
-
setAjaxLoadingImage
public void setAjaxLoadingImage(java.lang.String ajaxLoadingImage)
-
setAddChannelBaseUrl
public void setAddChannelBaseUrl(boolean addChannelBaseUrl)
-
setDataAttribute
public void setDataAttribute(DataAttribute dataAttribute)
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
doAfterBody
public int doAfterBody() throws javax.servlet.jsp.JspException
- Specified by:
doAfterBody
in interfacejavax.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
createThumbnailFromSessionAttribute
public static java.lang.String createThumbnailFromSessionAttribute(java.lang.String sessionAttrName) throws java.lang.Exception
- Parameters:
sessionAttrName
- the name of session attribute Map object in which all options were stored- Returns:
- relative thumbnail path if the thumbnail was created, null otherwise
- Throws:
java.lang.Exception
- if option 'urlStr' (from option map) could not be converted to URL
-
invalidateCacheAttemptThumbnail
public static void invalidateCacheAttemptThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url)
Invalidates the cache of failure while attempt to create a thumbnail for the given parameter. If not null, the key in the cache is for the FileDocument, otherwise, for the srcFile, otherwise for the file with given URL.- Parameters:
fileDoc
- the FileDocument to invalidate cache thumbnail generation failuresrcFile
- the file to invalidate the cacheurl
- the URL of the file to invalidate the cache- Since:
- jcms-6.1.2
-
buildThumbnail
public static java.io.File buildThumbnail(java.io.File srcFile, int width, int height, java.io.File defaultFile, java.lang.String background)
Returns a Thumbnail for the given path. If thumbnail do not exists then create it.Warning : This method does not use any cache for failed attemps and may not meet performance requirements of frequent use. Use method
createThumbnail(FileDocument, File, URL, ImageFormat, int, int)
instead.- Parameters:
srcFile
- the original filewidth
- target max widthheight
- target max widthdefaultFile
- the default file to use if thumbnail do not existsbackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight- Returns:
- File the thumbnail file
-
buildThumbnail
public static java.lang.String buildThumbnail(java.lang.String path, int width, int height, java.lang.String defaultPath)
- Parameters:
path
- Relative path to the original filewidth
- target max widthheight
- target max widthdefaultPath
- the default image to use if thumbnail do not exists- Returns:
- String relative path to the thumbnail
- See Also:
buildThumbnail(String, int, int, String, String)
-
buildThumbnail
public static java.lang.String buildThumbnail(java.lang.String path, int width, int height, java.lang.String defaultPath, java.lang.String background)
Returns a Thumbnail for the given path. If thumbnail do not exists then create it.Warning : This method does not use any cache for failed attemps and may not meet performance requirements of frequent use. Use method
createThumbnail(FileDocument, File, URL, ImageFormat, int, int)
instead.- Parameters:
path
- Relative path to the original filewidth
- target max widthheight
- target max widthdefaultPath
- the default image to use if thumbnail do not existsbackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight- Returns:
- String relative path to the thumbnail
-
createThumbnail
public static java.io.File createThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight)
- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailformat
- theImageFormat
of the file to generate (default to JPEG if null)maxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generate- Returns:
- the thumbnail file on success, or null if the thumbnail could not be created.
- See Also:
createThumbnail(FileDocument, File, URL, ImageFormat, int, int, String)
-
createThumbnail
public static java.io.File createThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background)
Create a thumbnail using the first valid source from FileDocument, File or URL using given dimensions.For performance reason, if a previous thumbnail creation attempt failed for the specified source, this method will not perform any creation until the delay specified by property "tag.thumbnail.failed-attempt-check-delay" has been reached (or if site is restarted).
Be careful though that this method is not asynchronous and thus may take some time to process if thumbnail creation processing is long.- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailformat
- theImageFormat
of the file to generate (default to JPEG if null)maxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight- Returns:
- the thumbnail file on success, or null if the thumbnail could not be created.
- Since:
- jcms-6.1
-
createThumbnail
public static java.io.File createThumbnail(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
Create a thumbnail using the first valid source from FileDocument, File or URL using given dimensions.For performance reason, if a previous thumbnail creation attempt failed for the specified source, this method will not perform any creation until the delay specified by property "tag.thumbnail.failed-attempt-check-delay" has been reached (or if site is restarted).
Be careful though that this method is not asynchronous and thus may take some time to process if thumbnail creation processing is long.- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailformat
- theImageFormat
of the file to generate (default to the format specified in property "tag.thumbnail.format" if null)maxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeightsquare
- set to true to crop image into a square using the specified width during thumbnail creation.- Returns:
- the thumbnail file on success, or null if the thumbnail could not be created.
- Since:
- jcms-9.0
-
getThumbnailFile
public static java.io.File getThumbnailFile(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, int maxWidth, int maxHeight)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions.- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailmaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.- Returns:
- a File representing the thumbnail filename or null if none could be computed.
- Since:
- jcms-6.1
-
getThumbnailFile
public static java.io.File getThumbnailFile(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, int maxWidth, int maxHeight, boolean square)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions.- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailmaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.square
- set to true to indicate image is cropped into a square- Returns:
- a File representing the thumbnail filename or null if none could be computed.
- Since:
- jcms-9.0
-
getThumbnailFile
public static java.io.File getThumbnailFile(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, int maxWidth, int maxHeight, boolean square, java.lang.String extension)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions.- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailmaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.square
- set to true to indicate image is cropped into a squareextension
- the extension of the thumbnail format being create/generated/manipulated. eg"jpg"
This value is not used when generating URL. See propertytag.thumbnail.thumbshot.file-ext
.- Returns:
- a File representing the thumbnail filename or null if none could be computed.
- Since:
- jcms-10.0.1 JCMS-4762
-
createThumbnailNow
public static boolean createThumbnailNow(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.io.File destFile)
- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailformat
- theImageFormat
of the file to generate (default to JPEG if null)maxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatedestFile
- destination file (of the thumbnail to generate)- Returns:
- true on success, or false if the thumbnail could not be created
- See Also:
createThumbnailNow(FileDocument, File, URL, ImageFormat, int, int, File, String)
,ThumbnailPolicyFilter.createThumbnail(FileDocument, File, ImageFormat, int, int, String, boolean, boolean)
,ThumbnailPolicyFilter.createThumbnail(File, File, ImageFormat, int, int, String, boolean, boolean)
,ThumbnailPolicyFilter.createThumbnail(URL, File, ImageFormat, int, int, String, boolean, boolean)
-
createThumbnailNow
public static boolean createThumbnailNow(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.io.File destFile, java.lang.String background)
This method create a thumbnail of one of the three source given using the options passed as parameters ("now" as opposed to generation when going through ajax}.Warning : This method does not use any cache for failed attemps and may not meet performance requirements of frequent use. Use method
createThumbnail(FileDocument, File, URL, ImageFormat, int, int)
instead. Possible sources are (only of must be passed, other must be null) :- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailformat
- theImageFormat
of the file to generate (default to JPEG if null)maxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatedestFile
- destination file (of the thumbnail to generate)background
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight- Returns:
- true on success, or false if the thumbnail could not be created
- See Also:
ThumbnailPolicyFilter.createThumbnail(FileDocument, File, ImageFormat, int, int, String, boolean, boolean)
,ThumbnailPolicyFilter.createThumbnail(File, File, ImageFormat, int, int, String, boolean, boolean)
,ThumbnailPolicyFilter.createThumbnail(URL, File, ImageFormat, int, int, String, boolean, boolean)
-
createThumbnailNow
public static boolean createThumbnailNow(FileDocument fileDoc, java.io.File srcFile, java.net.URL url, ImageFormat format, int maxWidth, int maxHeight, java.io.File destFile, java.lang.String background, boolean square)
This method create a thumbnail of one of the three source given using the options passed as parameters ("now" as opposed to generation when going through ajax}.Warning : This method does not use any cache for failed attemps and may not meet performance requirements of frequent use. Use method
createThumbnail(FileDocument, File, URL, ImageFormat, int, int)
instead. Possible sources are (only of must be passed, other must be null) :- Parameters:
fileDoc
- aFileDocument
of which to create thumbnailsrcFile
- aFile
of which to create thumbnailurl
- anURL
of which to create thumbnailformat
- theImageFormat
of the file to generate (default to JPEG if null)maxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatedestFile
- destination file (of the thumbnail to generate)background
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeightsquare
- set to true to crop image into a square using the specified width during thumbnail creation.- Returns:
- true on success, or false if the thumbnail could not be created
- Since:
- jcms-9.0
- See Also:
ThumbnailPolicyFilter.createThumbnail(FileDocument, File, ImageFormat, int, int, String, boolean, boolean)
,ThumbnailPolicyFilter.createThumbnail(File, File, ImageFormat, int, int, String, boolean, boolean)
,ThumbnailPolicyFilter.createThumbnail(URL, File, ImageFormat, int, int, String, boolean, boolean)
-
createImageThumbnail
public static boolean createImageThumbnail(java.io.File imageFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight)
- Parameters:
imageFile
- image file of which to create a thumbnaildest
- destination file (the thumbnail to generate)format
- the format of the file to generate as requested by the ThumbnailTagmaxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generate- Returns:
- true on success, or false if the thumbnail could not be created
- See Also:
createImageThumbnail(File, File, ImageFormat, int, int, String)
-
createImageThumbnail
public static boolean createImageThumbnail(java.io.File imageFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background)
This method creates a thumbnail of the given image source file.- Parameters:
imageFile
- image file of which to create a thumbnaildest
- destination file (the thumbnail to generate)format
- the format of the file to generate as requested by the ThumbnailTagmaxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight- Returns:
- true on success, or false if the thumbnail could not be created
- See Also:
ImageUtil.createThumbnail(File, ImageFormat, int, int)
-
createImageThumbnail
public static boolean createImageThumbnail(java.io.File imageFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
This method creates a thumbnail of the given image source file.- Parameters:
imageFile
- image file of which to create a thumbnaildest
- destination file (the thumbnail to generate)format
- the format of the file to generate as requested by the ThumbnailTagmaxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeightsquare
- set to true to crop image into a square using the specified width during thumbnail creation.- Returns:
- true on success, or false if the thumbnail could not be created
- Since:
- jcms-9.0
- See Also:
ImageUtil.createThumbnail(File, ImageFormat, int, int)
-
createOpenOfficeThumbnail
public static boolean createOpenOfficeThumbnail(java.io.File docFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
This method creates a thumbnail of the given Open Office file.- Parameters:
docFile
- Open Office file of which to create a thumbnaildest
- destination file (the thumbnail to generate)format
- the format of the file to generate as requested by the ThumbnailTagmaxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeightsquare
- set to true to crop image into a square using the specified width during thumbnail creation.- Returns:
- true on success, or false if the thumbnail could not be created
- See Also:
ImageUtil.createThumbnail(File, ImageFormat, int, int)
-
createOpenXmlThumbnail
public static boolean createOpenXmlThumbnail(java.io.File docFile, java.io.File dest, ImageFormat format, int maxWidth, int maxHeight, java.lang.String background, boolean square)
This method creates a thumbnail of the given OpenXml file.- Parameters:
docFile
- Open Office file of which to create a thumbnaildest
- destination file (the thumbnail to generate)format
- the format of the file to generate as requested by the ThumbnailTagmaxWidth
- the maximum width of the thumbnail to generatemaxHeight
- the maximum height of the thumbnail to generatebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeightsquare
- set to true to crop image into a square using the specified width during thumbnail creation.- Returns:
- true on success, or false if the thumbnail could not be created
- See Also:
ImageUtil.createThumbnail(File, ImageFormat, int, int)
-
-