Class CheckImageSizeProcessor
- java.lang.Object
-
- org.craftercms.studio.impl.v1.content.pipeline.BaseContentProcessor
-
- org.craftercms.studio.impl.v1.content.pipeline.PathMatchProcessor
-
- org.craftercms.studio.impl.v1.content.pipeline.CheckImageSizeProcessor
-
- All Implemented Interfaces:
ContentProcessor
public class CheckImageSizeProcessor extends PathMatchProcessor
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME
-
Fields inherited from class org.craftercms.studio.impl.v1.content.pipeline.PathMatchProcessor
_matchPaths, _unmatchPaths
-
Fields inherited from class org.craftercms.studio.impl.v1.content.pipeline.BaseContentProcessor
_name
-
-
Constructor Summary
Constructors Constructor Description CheckImageSizeProcessor()
default constructorCheckImageSizeProcessor(String name)
constructor that sets the process name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected InputStream
checkForImageSize(InputStream in, int allowedWidth, int allowedHeight, boolean lessSize, ContentAssetInfoTO assetInfo)
check the width and the height of the given image as an inputstream match the width and the height specifiedvoid
process(PipelineContent content, ResultTO result)
process the content at the given path.protected void
validateImageSize(int allowedWidth, int allowedHeight, int height, int width, boolean lessSize)
validate the image width and height against the allowed width and height-
Methods inherited from class org.craftercms.studio.impl.v1.content.pipeline.PathMatchProcessor
isProcessable, setMatchPaths, setUnmatchPaths
-
Methods inherited from class org.craftercms.studio.impl.v1.content.pipeline.BaseContentProcessor
checkForMandatoryParam, getName, setName
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CheckImageSizeProcessor
public CheckImageSizeProcessor()
default constructor
-
CheckImageSizeProcessor
public CheckImageSizeProcessor(String name)
constructor that sets the process name- Parameters:
name
-
-
-
Method Detail
-
process
public void process(PipelineContent content, ResultTO result) throws ContentProcessException
Description copied from interface:ContentProcessor
process the content at the given path.- Specified by:
process
in interfaceContentProcessor
- Overrides:
process
in classBaseContentProcessor
- Parameters:
content
- content to processresult
- result to return- Throws:
ContentProcessException
-
checkForImageSize
protected InputStream checkForImageSize(InputStream in, int allowedWidth, int allowedHeight, boolean lessSize, ContentAssetInfoTO assetInfo) throws ContentProcessException
check the width and the height of the given image as an inputstream match the width and the height specified- Parameters:
in
-allowedWidth
-allowedHeight
-lessSize
-assetInfo
-- Returns:
- image as input stream
- Throws:
ContentProcessException
-
validateImageSize
protected void validateImageSize(int allowedWidth, int allowedHeight, int height, int width, boolean lessSize) throws ContentNotAllowedException
validate the image width and height against the allowed width and height- Parameters:
allowedWidth
-allowedHeight
-height
-width
-lessSize
-- Throws:
ContentNotAllowedException
-
-