|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport javax.servlet.jsp.tagext.BodyTagSupport com.jalios.jcms.taglib.ThumbnailTag
public class ThumbnailTag
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 method createThumbnail(FileDocument, File, URL, ImageFormat, int, int)
which use same internal cache.
Field Summary | |
---|---|
static int |
MAX_THUMB_SIZE
|
static int |
MIN_THUMB_SIZE
|
static String |
REVISION
|
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
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 javax.servlet.jsp.tagext.BodyTag |
---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
ThumbnailTag()
|
Method Summary | |
---|---|
static File |
buildThumbnail(File srcFile,
int width,
int height,
File defaultFile)
Returns a Thumbnail for the given path. |
static String |
buildThumbnail(String path,
int width,
int height,
String defaultPath)
Returns a Thumbnail for the given path. |
protected void |
clean()
|
static boolean |
createImageThumbnail(File imageFile,
File dest,
ImageFormat format,
int maxWidth,
int maxHeight)
This method creates a thumbnail of the given image source file. |
static boolean |
createOpenOfficeThumbnail(File docFile,
File dest,
ImageFormat format,
int maxWidth,
int maxHeight)
This method creates a thumbnail of the given Open Office file. |
static boolean |
createOpenXmlThumbnail(File docFile,
File dest,
ImageFormat format,
int maxWidth,
int maxHeight)
This method creates a thumbnail of the given OpenXml file. |
static File |
createThumbnail(FileDocument fileDoc,
File srcFile,
URL url,
ImageFormat format,
int maxWidth,
int maxHeight)
Create a thumbnail using the first valid source from FileDocument, File or URL using given dimensions. |
static String |
createThumbnailFromSessionAttribute(String sessionAttrName)
|
static boolean |
createThumbnailNow(FileDocument fileDoc,
File srcFile,
URL url,
ImageFormat format,
int maxWidth,
int maxHeight,
File destFile)
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 File |
getThumbnailFile(FileDocument fileDoc,
File srcFile,
URL url,
int maxWidth,
int maxHeight)
Gets the File to use for a thumbnail of the given FileDocument, File or URL using given dimensions. |
void |
setAjaxLoadingImage(String ajaxLoadingImage)
|
void |
setAlt(String alt)
|
void |
setCss(String css)
|
void |
setDestination(String path)
|
void |
setFile(File file)
|
void |
setFileDoc(FileDocument fd)
|
void |
setForceUpdate(boolean forceUpdate)
|
void |
setFormat(String format)
|
void |
setHeight(int height)
|
void |
setHtmlAttributes(String htmlAttributes)
|
void |
setPath(String path)
|
void |
setUrl(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, resetCustomAttributes, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
---|
getParent, setPageContext, setParent |
Field Detail |
---|
public static final String REVISION
public static final int MAX_THUMB_SIZE
public static final int MIN_THUMB_SIZE
Constructor Detail |
---|
public ThumbnailTag()
Method Detail |
---|
protected void clean()
public void setFileDoc(FileDocument fd)
public void setFile(File file)
public void setPath(String path)
public void setUrl(String purl)
public void setFormat(String format)
public void setWidth(int width)
public void setHeight(int height)
public void setDestination(String path)
public void setForceUpdate(boolean forceUpdate)
public void setAlt(String alt)
public void setCss(String css)
public void setHtmlAttributes(String htmlAttributes)
public void setUseAjaxLoading(boolean useAjaxLoading)
public void setAjaxLoadingImage(String ajaxLoadingImage)
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
public int doAfterBody() throws javax.servlet.jsp.JspException
doAfterBody
in interface javax.servlet.jsp.tagext.BodyTag
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
public static String createThumbnailFromSessionAttribute(String sessionAttrName) throws Exception
sessionAttrName
- the name of session attribute Map object in which all options were stored
Exception
- if option 'urlStr' (from option map) could not be converted to URLpublic static File buildThumbnail(File srcFile, int width, int height, File defaultFile)
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.
srcFile
- the original filewidth
- target max widthheight
- target max widthdefaultFile
- the default file to use if thumbnail do not exists
public static String buildThumbnail(String path, int width, int height, String defaultPath)
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.
path
- Relative path to the original filewidth
- target max widthheight
- target max widthdefaultPath
- the default image to use if thumbnail do not exists
public static File createThumbnail(FileDocument fileDoc, File srcFile, URL url, ImageFormat format, int maxWidth, int maxHeight)
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.
fileDoc
- a FileDocument
of which to create thumbnailsrcFile
- a File
of which to create thumbnailurl
- an URL
of which to create thumbnailformat
- the ImageFormat
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
public static File getThumbnailFile(FileDocument fileDoc, File srcFile, URL url, int maxWidth, int maxHeight)
fileDoc
- a FileDocument
of which to create thumbnailsrcFile
- a File
of which to create thumbnailurl
- an URL
of which to create thumbnailmaxWidth
- the maximum width of the thumbnail, a positive integer.maxHeight
- the maximum height of the thumbnail, a positive integer.
public static boolean createThumbnailNow(FileDocument fileDoc, File srcFile, URL url, ImageFormat format, int maxWidth, int maxHeight, File destFile)
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) :
fileDoc
- a FileDocument
of which to create thumbnailsrcFile
- a File
of which to create thumbnailurl
- an URL
of which to create thumbnailformat
- the ImageFormat
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)
PolicyManager.createThumbnail(FileDocument, File, ImageFormat, int, int)
,
PolicyManager.createThumbnail(File, File, ImageFormat, int, int)
,
PolicyManager.createThumbnail(URL, File, ImageFormat, int, int)
public static boolean createImageThumbnail(File imageFile, File dest, ImageFormat format, int maxWidth, int maxHeight)
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
ImageUtil.createThumbnail(File, ImageFormat, int, int)
public static boolean createOpenOfficeThumbnail(File docFile, File dest, ImageFormat format, int maxWidth, int maxHeight)
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 generate
ImageUtil.createThumbnail(File, ImageFormat, int, int)
public static boolean createOpenXmlThumbnail(File docFile, File dest, ImageFormat format, int maxWidth, int maxHeight)
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 generate
ImageUtil.createThumbnail(File, ImageFormat, int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |