Package org.codelibs.fess.thumbnail.impl
Class HtmlTagBasedGenerator
java.lang.Object
org.codelibs.fess.thumbnail.impl.BaseThumbnailGenerator
org.codelibs.fess.thumbnail.impl.HtmlTagBasedGenerator
- All Implemented Interfaces:
ThumbnailGenerator
HTML tag-based thumbnail generator that creates thumbnails from image content
referenced in HTML documents. This generator extracts images from HTML content
and processes them to create thumbnail images based on configured dimensions
and format settings.
The generator validates image MIME types, processes image data through ImageIO operations, and applies scaling and cropping to generate thumbnails that meet the specified size requirements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumEnumeration representing the possible results of thumbnail image processing. -
Field Summary
Fields inherited from class org.codelibs.fess.thumbnail.impl.BaseThumbnailGenerator
available, conditionMap, directoryNameLength, filePathMap, generatorList, maxRedirectCount, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateTask(String path, Map<String, Object> docMap) Creates a thumbnail generation task for the specified document.voiddestroy()Destroys this thumbnail generator and releases any resources.booleanGenerates a thumbnail image and saves it to the specified output file.protected booleanisImageMimeType(org.codelibs.fess.crawler.entity.ResponseData responseData) Checks if the response data contains an image MIME type that can be processed for thumbnail generation.protected HtmlTagBasedGenerator.ResultsaveImage(ImageInputStream input, File outputFile) Processes and saves an image from the input stream to the output file as a thumbnail.Methods inherited from class org.codelibs.fess.thumbnail.impl.BaseThumbnailGenerator
addCondition, expandPath, getName, isAvailable, isTarget, process, process, register, setDirectoryNameLength, setGeneratorList, setMaxRedirectCount, setName, updateThumbnailField
-
Constructor Details
-
HtmlTagBasedGenerator
public HtmlTagBasedGenerator()Default constructor for HtmlTagBasedGenerator.
-
-
Method Details
-
destroy
public void destroy()Destroys this thumbnail generator and releases any resources. This implementation is empty as no cleanup is required. -
createTask
public org.codelibs.core.misc.Tuple3<String,String, createTaskString> (String path, Map<String, Object> docMap) Creates a thumbnail generation task for the specified document.- Specified by:
createTaskin interfaceThumbnailGenerator- Overrides:
createTaskin classBaseThumbnailGenerator- Parameters:
path- the file path or URL of the documentdocMap- the document metadata map containing field values- Returns:
- a tuple containing the generator name, thumbnail ID, and path
-
generate
Generates a thumbnail image and saves it to the specified output file.This method processes the image content associated with the thumbnail ID, validates the image format, applies scaling and cropping transformations, and writes the resulting thumbnail to the output file.
- Parameters:
thumbnailId- the unique identifier for the thumbnailoutputFile- the file where the generated thumbnail will be saved- Returns:
- true if the thumbnail was successfully generated, false otherwise
-
isImageMimeType
protected boolean isImageMimeType(org.codelibs.fess.crawler.entity.ResponseData responseData) Checks if the response data contains an image MIME type that can be processed for thumbnail generation.- Parameters:
responseData- the response data containing MIME type information- Returns:
- true if the MIME type represents a supported image format, false otherwise
-
saveImage
protected HtmlTagBasedGenerator.Result saveImage(ImageInputStream input, File outputFile) throws IOException Processes and saves an image from the input stream to the output file as a thumbnail.This method reads image data, validates dimensions, applies subsampling and scaling transformations based on configuration settings, and writes the processed thumbnail to the specified output file.
- Parameters:
input- the image input stream containing the source image dataoutputFile- the file where the processed thumbnail will be saved- Returns:
- the result of the image processing operation
- Throws:
IOException- if an error occurs during image reading or writing operations
-