Class FeaturedImageResolverConfig
java.lang.Object
com.norconex.crawler.web.doc.operations.image.impl.FeaturedImageResolverConfig
Configuration for FeaturedImageResolver.
- Since:
- 2.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumType of featured image storages.static enumDirectory structure when storing images on disk. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final Dimensionstatic final Stringstatic final Dimensionstatic final FeaturedImageResolverConfig.Storagestatic final StringDefault featured image directory, relative to the crawler working directory.static final FeaturedImageResolverConfig.StorageDiskStructurestatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanOptional CSS-like path matching one or more image elements.intMaximum number of images to cache in memory for faster processing.Target format of stored image.Minimum pixel size for an image to be considered.Optional regex to overwrite default matching of HTML pages.Target pixel size the featured image should be scaled to.Desired scaling quality.Path to directory where to store images on disk.Name of metadata field where to store the local path to an image.The type of directory structure to create when one of the values of ofgetStorages()isFeaturedImageResolverConfig.Storage.DISK.Name of metadata field where to store the Base64 image.Gets the storages mechanisms.Name of metadata field where to store the remote image URL.inthashCode()booleanWhen more than one featured image is found, whether to return the largest of them all (as opposed to the first one encountered).booleanWhether to stretch to match scale size.setDomSelector(String domSelector) Optional CSS-like path matching one or more image elements.setImageCacheSize(int imageCacheSize) Maximum number of images to cache in memory for faster processing.setImageFormat(String imageFormat) Target format of stored image.setLargest(boolean largest) When more than one featured image is found, whether to return the largest of them all (as opposed to the first one encountered).setMinDimensions(Dimension minDimensions) Minimum pixel size for an image to be considered.setPageContentTypePattern(String pageContentTypePattern) Optional regex to overwrite default matching of HTML pages.setScaleDimensions(Dimension scaleDimensions) Target pixel size the featured image should be scaled to.setScaleQuality(FeaturedImageResolverConfig.Quality scaleQuality) Desired scaling quality.setScaleStretch(boolean scaleStretch) Whether to stretch to match scale size.setStorageDiskDir(Path storageDiskDir) Path to directory where to store images on disk.setStorageDiskField(String storageDiskField) Name of metadata field where to store the local path to an image.setStorageDiskStructure(FeaturedImageResolverConfig.StorageDiskStructure storageDiskStructure) The type of directory structure to create when one of the values of ofgetStorages()isFeaturedImageResolverConfig.Storage.DISK.setStorageInlineField(String storageInlineField) Name of metadata field where to store the Base64 image.setStorages(List<FeaturedImageResolverConfig.Storage> storages) Sets the storages mechanisms.setStorageUrlField(String storageUrlField) Name of metadata field where to store the remote image URL.toString()
-
Field Details
-
FEATURED_IMAGE_URL_FIELD
- See Also:
-
FEATURED_IMAGE_PATH_FIELD
- See Also:
-
FEATURED_IMAGE_INLINE_FIELD
- See Also:
-
DEFAULT_PAGE_CONTENT_TYPE_PATTERN
- See Also:
-
DEFAULT_IMAGE_CACHE_SIZE
public static final int DEFAULT_IMAGE_CACHE_SIZE- See Also:
-
DEFAULT_STORAGE_DISK_DIR
Default featured image directory, relative to the crawler working directory.- See Also:
-
DEFAULT_IMAGE_FORMAT
- See Also:
-
DEFAULT_MIN_SIZE
-
DEFAULT_SCALE_SIZE
-
DEFAULT_STORAGE
-
DEFAULT_STORAGE_DISK_STRUCTURE
-
-
Constructor Details
-
FeaturedImageResolverConfig
public FeaturedImageResolverConfig()
-
-
Method Details
-
getStorages
Gets the storages mechanisms.- Returns:
- storages mechanisms
-
setStorages
Sets the storages mechanisms.- Parameters:
storages- storages mechanisms- Returns:
- this
-
getPageContentTypePattern
Optional regex to overwrite default matching of HTML pages. Default is "text/html|application/(xhtml\\+xml|vnd\\.wap.xhtml\\+xml|x-asp)" -
getDomSelector
Optional CSS-like path matching one or more image elements. -
getMinDimensions
Minimum pixel size for an image to be considered. Default is 400x400. -
getScaleDimensions
Target pixel size the featured image should be scaled to. Default is 150x150. -
isScaleStretch
public boolean isScaleStretch()Whether to stretch to match scale size. Default keeps aspect ratio. -
getImageFormat
Target format of stored image. E.g., "jpg", "png", "gif", "bmp", ... Default is "png" -
getImageCacheSize
public int getImageCacheSize()Maximum number of images to cache in memory for faster processing. The cache prevents re-downloading and re-scaling the same image when it appears on multiple pages. Set to 0 to disable caching. Default is 200. -
isLargest
public boolean isLargest()When more than one featured image is found, whether to return the largest of them all (as opposed to the first one encountered). -
getStorageDiskDir
Path to directory where to store images on disk. Only applicable when one of the values ofgetStorages()isFeaturedImageResolverConfig.Storage.DISK. -
getStorageDiskStructure
The type of directory structure to create when one of the values of ofgetStorages()isFeaturedImageResolverConfig.Storage.DISK. -
getScaleQuality
Desired scaling quality. Default isFeaturedImageResolverConfig.Quality.AUTO, which tries the best balance between quality and speed based on image size. The lower the quality the faster it is to scale images. -
getStorageDiskField
Name of metadata field where to store the local path to an image. Only applicable if one of thegetStorages()values isFeaturedImageResolverConfig.Storage.DISK. Default is "crawler.featured-image-path" -
getStorageInlineField
Name of metadata field where to store the Base64 image. Only applicable if one of thegetStorages()values isFeaturedImageResolverConfig.Storage.INLINE. Default is "crawler.featured-image-inline" -
getStorageUrlField
Name of metadata field where to store the remote image URL. Only applicable if one of thegetStorages()values isFeaturedImageResolverConfig.Storage.URL. Default is "crawler.featured-image-url" -
setPageContentTypePattern
Optional regex to overwrite default matching of HTML pages. Default is "text/html|application/(xhtml\\+xml|vnd\\.wap.xhtml\\+xml|x-asp)"- Returns:
this.
-
setDomSelector
Optional CSS-like path matching one or more image elements.- Returns:
this.
-
setMinDimensions
Minimum pixel size for an image to be considered. Default is 400x400.- Returns:
this.
-
setScaleDimensions
Target pixel size the featured image should be scaled to. Default is 150x150.- Returns:
this.
-
setScaleStretch
Whether to stretch to match scale size. Default keeps aspect ratio.- Returns:
this.
-
setImageFormat
Target format of stored image. E.g., "jpg", "png", "gif", "bmp", ... Default is "png"- Returns:
this.
-
setImageCacheSize
Maximum number of images to cache in memory for faster processing. The cache prevents re-downloading and re-scaling the same image when it appears on multiple pages. Set to 0 to disable caching. Default is 200.- Returns:
this.
-
setLargest
When more than one featured image is found, whether to return the largest of them all (as opposed to the first one encountered).- Returns:
this.
-
setStorageDiskDir
Path to directory where to store images on disk. Only applicable when one of the values ofgetStorages()isFeaturedImageResolverConfig.Storage.DISK.- Returns:
this.
-
setStorageDiskStructure
public FeaturedImageResolverConfig setStorageDiskStructure(FeaturedImageResolverConfig.StorageDiskStructure storageDiskStructure) The type of directory structure to create when one of the values of ofgetStorages()isFeaturedImageResolverConfig.Storage.DISK.- Returns:
this.
-
setScaleQuality
public FeaturedImageResolverConfig setScaleQuality(FeaturedImageResolverConfig.Quality scaleQuality) Desired scaling quality. Default isFeaturedImageResolverConfig.Quality.AUTO, which tries the best balance between quality and speed based on image size. The lower the quality the faster it is to scale images.- Returns:
this.
-
setStorageDiskField
Name of metadata field where to store the local path to an image. Only applicable if one of thegetStorages()values isFeaturedImageResolverConfig.Storage.DISK. Default is "crawler.featured-image-path"- Returns:
this.
-
setStorageInlineField
Name of metadata field where to store the Base64 image. Only applicable if one of thegetStorages()values isFeaturedImageResolverConfig.Storage.INLINE. Default is "crawler.featured-image-inline"- Returns:
this.
-
setStorageUrlField
Name of metadata field where to store the remote image URL. Only applicable if one of thegetStorages()values isFeaturedImageResolverConfig.Storage.URL. Default is "crawler.featured-image-url"- Returns:
this.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-