Class ImageVersion


public class ImageVersion extends DimensionVersion
A version of a resource that contains an Image.
  • Method Details

    • scale

      public ImageVersion scale(Integer width, Integer height) throws IOException
      Description copied from class: DimensionVersion
      Scales this version to a different resolution, using cached version if previously scaled.

      This will typically be done on the original version, but can be performed on any version.

      First searches all versions for any of this type and matching dimension. If found, returns it. Tracks which version had the highest resolution while performing this search.

      Will only scale down from the biggest existing resource. A request to scale up will return the highest resolution available.

      Will only perform proportional scaling. If both width and height are specified, returns the largest, possibly scaled, image that fits both the width and the height. The resulting width or height may be less than the requested scaling, but will not be more. The user interface could perform letterboxing if needing to fit into a fix proportion area.

      Locks the resource while performing the search. This search should be very quick, and this locking will prevent duplicate work when performing a new scaling.

      Synchronizes the cluster, but only after releasing the lock. If different nodes create the same version at the same time, the cluster confict will be resolved through standard monitoring and administration.

      Overrides:
      scale in class DimensionVersion
      Parameters:
      width - The desired width or null for proportional scaling
      height - The desired height or null for proportional scaling
      Returns:
      When both width and height are null, return this. When resulting dimensions match this version, return this. Otherwise return a closest-match scaled version.
      Throws:
      IOException