Package com.cksource.ckfinder.image
Class ResizedImage
java.lang.Object
com.cksource.ckfinder.image.ResizedImage
Class representing resized image file.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionResizedImage
(InputStream inputStream, String mimeType) Constructs resized image using image data stream and mime type. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResizedImage
Factory method that constructsResizedImage
fromImage
.static ResizedImage
fromInputStream
(InputStream inputStream) Factory method that constructsResizedImage
fromImage
.static ImageSize
getSizeFromFileName
(String fileName) Extracts the image dimensions from given resized image file name.setFileName
(String fileName) Sets the file name of this resized image.
-
Field Details
-
DIRECTORY
Internal directory name used to store the resized versions of images.- See Also:
-
-
Constructor Details
-
ResizedImage
Constructs resized image using image data stream and mime type.- Parameters:
inputStream
- image data streammimeType
- mime type
-
-
Method Details
-
fromImage
Factory method that constructsResizedImage
fromImage
.- Parameters:
image
- image instance- Returns:
- resized image
- Throws:
IOException
- in case of any processing exception
-
fromInputStream
Factory method that constructsResizedImage
fromImage
.- Parameters:
inputStream
- image data input stream- Returns:
- resized image
- Throws:
IOException
- in case of any processing exception
-
getInputStream
- Returns:
- this resized image data stream
-
getMimeType
- Returns:
- this resized image mime type
-
getFileName
- Returns:
- this resized image file name
-
setFileName
Sets the file name of this resized image.- Parameters:
fileName
- file name- Returns:
- this
-
getSizeFromFileName
Extracts the image dimensions from given resized image file name.Resized image files use a naming convention which assumes that image width and height are presented as the part of the file name. For file named
foo__300x400.jpg
this method returnsImageSize
instance that holds the extracted width (300) and height (400).- Parameters:
fileName
- file name- Returns:
- image size object
-