public class ResizedImage extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DIRECTORY
Internal directory name used to store the resized versions of images.
|
Constructor and Description |
---|
ResizedImage(InputStream inputStream,
String mimeType)
Constructs resized image using image data stream and mime type.
|
Modifier and Type | Method and Description |
---|---|
static ResizedImage |
fromImage(Image image)
Factory method that constructs
ResizedImage from Image . |
static ResizedImage |
fromInputStream(InputStream inputStream)
Factory method that constructs
ResizedImage from Image . |
String |
getFileName() |
InputStream |
getInputStream() |
String |
getMimeType() |
static ImageSize |
getSizeFromFileName(String fileName)
Extracts the image dimensions from given resized image file name.
|
ResizedImage |
setFileName(String fileName)
Sets the file name of this resized image.
|
public static final String DIRECTORY
public ResizedImage(InputStream inputStream, String mimeType)
inputStream
- image data streammimeType
- mime typepublic static ResizedImage fromImage(Image image) throws IOException
ResizedImage
from Image
.image
- image instanceIOException
- in case of any processing exceptionpublic static ResizedImage fromInputStream(InputStream inputStream) throws IOException
ResizedImage
from Image
.inputStream
- image data input streamIOException
- in case of any processing exceptionpublic InputStream getInputStream()
public String getMimeType()
public String getFileName()
public ResizedImage setFileName(String fileName)
fileName
- file namepublic static ImageSize getSizeFromFileName(String fileName)
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 returns
ImageSize
instance that holds the extracted width (300) and height (400).
fileName
- file nameCopyright © 2007 – 2019 CKSource - Frederico Knabben. All rights reserved.