Class ResizedImage

java.lang.Object
com.cksource.ckfinder.image.ResizedImage

public class ResizedImage extends Object
Class representing resized image file.
  • Field Details

    • DIRECTORY

      public static final String DIRECTORY
      Internal directory name used to store the resized versions of images.
      See Also:
  • Constructor Details

    • ResizedImage

      public ResizedImage(InputStream inputStream, String mimeType)
      Constructs resized image using image data stream and mime type.
      Parameters:
      inputStream - image data stream
      mimeType - mime type
  • Method Details

    • fromImage

      public static ResizedImage fromImage(Image image) throws IOException
      Factory method that constructs ResizedImage from Image.
      Parameters:
      image - image instance
      Returns:
      resized image
      Throws:
      IOException - in case of any processing exception
    • fromInputStream

      public static ResizedImage fromInputStream(InputStream inputStream) throws IOException
      Factory method that constructs ResizedImage from Image.
      Parameters:
      inputStream - image data input stream
      Returns:
      resized image
      Throws:
      IOException - in case of any processing exception
    • getInputStream

      public InputStream getInputStream()
      Returns:
      this resized image data stream
    • getMimeType

      public String getMimeType()
      Returns:
      this resized image mime type
    • getFileName

      public String getFileName()
      Returns:
      this resized image file name
    • setFileName

      public ResizedImage setFileName(String fileName)
      Sets the file name of this resized image.
      Parameters:
      fileName - file name
      Returns:
      this
    • getSizeFromFileName

      public static ImageSize getSizeFromFileName(String fileName)
      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 returns ImageSize instance that holds the extracted width (300) and height (400).

      Parameters:
      fileName - file name
      Returns:
      image size object