Class BasicThumbnailPolicyFilter

java.lang.Object
com.jalios.jcms.policy.AbstractPolicyFilter
com.jalios.jcms.policy.BasicThumbnailPolicyFilter
All Implemented Interfaces:
GenericProvider, PluginComponent, PolicyFilter, ThumbnailPolicyFilter, Comparable
Direct Known Subclasses:
AbstractThumbnailPolicyFilterImpl, DefaultThumbnailPolicyFilter

public class BasicThumbnailPolicyFilter extends AbstractPolicyFilter implements ThumbnailPolicyFilter, PluginComponent
This class allow users to customize behaviour of widgets by re-writing call-back methods.
Since:
jcms-5.5.0
Author:
Jean-Philippe Encausse
See Also:
  • Constructor Details

    • BasicThumbnailPolicyFilter

      public BasicThumbnailPolicyFilter()
  • Method Details

    • init

      public boolean init(Plugin plugin)
      Description copied from interface: PluginComponent
      Initialize the component with the given plugin configuration
      Specified by:
      init in interface PluginComponent
      Parameters:
      plugin - the calling plugin
      Returns:
      true if the component has been correctly initialized.
      Since:
      jcms-5.7.1
      See Also:
    • init

      public void init(String providerName, JProperties subProperties)
      Description copied from interface: GenericProvider
      this method is called on provider's initialization
      Specified by:
      init in interface GenericProvider
      Parameters:
      providerName - the name of the provider, from class configuration property
      subProperties - the properties with the same prefix than the property describing the provider class
    • createThumbnail

      public boolean createThumbnail(File src, File dest, ImageFormat format, int maxWidth, int maxHeight, boolean done)
    • createThumbnail

      public boolean createThumbnail(FileDocument doc, File dest, ImageFormat format, int maxWidth, int maxHeight, boolean done)
    • createThumbnail

      public boolean createThumbnail(URL url, File dest, ImageFormat format, int maxWidth, int maxHeight, boolean done)
    • createThumbnail

      public boolean createThumbnail(File src, File dest, ImageFormat format, int maxWidth, int maxHeight, String background, boolean done)
    • createThumbnail

      public boolean createThumbnail(FileDocument doc, File dest, ImageFormat format, int maxWidth, int maxHeight, String background, boolean done)
    • createThumbnail

      public boolean createThumbnail(URL url, File dest, ImageFormat format, int maxWidth, int maxHeight, String background, boolean done)
    • createThumbnail

      public boolean createThumbnail(File src, File dest, ImageFormat format, int maxWidth, int maxHeight, String background, boolean square, boolean done)
      Description copied from interface: ThumbnailPolicyFilter
      This method is a hook called by Thumbnail tag to generate a thumbnail of the given source file.
      Specified by:
      createThumbnail in interface ThumbnailPolicyFilter
      Parameters:
      src - source file of which to create a thumbnail
      dest - destination file (the thumbnail to generate)
      format - the format of the file to generate as requested by the ThumbnailTag
      maxWidth - the maximum width of the thumbnail to generate
      maxHeight - the maximum height of the thumbnail to generate
      background - the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight
      square - set to true to crop image into a square using the specified width during thumbnail creation.
      done - the global plugin createThumbnail() status
      Returns:
      true on success, or false if the thumbnail could not be created
      See Also:
    • isValidImageSize

      public boolean isValidImageSize(File imgFile, long width, long height, boolean jcms)
      Description copied from interface: ThumbnailPolicyFilter
      Checks if the given dimension are below the limit above which we do not generate thumbnails
      Specified by:
      isValidImageSize in interface ThumbnailPolicyFilter
      Parameters:
      imgFile - the image File being checked (only used for logging)
      width - the widht of the image (in pixel)
      height - the heigth of the image (in pixel)
      jcms - the value computed by previous policy filter or the default jcms value if no filter has been invoked yet
      Returns:
      true if the given dimension are valid, false otherwise
      See Also:
    • supportsThumbnail

      public boolean supportsThumbnail(FileDocument doc, boolean jcms)
      Description copied from interface: ThumbnailPolicyFilter
      Returns true if a thumbnail can be generated for the given document. This method is called as an extension of FileDocument.supportsThumbnail().
      Specified by:
      supportsThumbnail in interface ThumbnailPolicyFilter
      Parameters:
      doc - the FileDocument to be checked
      jcms - the value computed by previous policy filter or the default jcms value if no filter has been invoked yet
      Returns:
      true if a thumbnail can be generated for the given document.
      See Also:
    • createThumbnail

      public boolean createThumbnail(FileDocument doc, File dest, ImageFormat format, int maxWidth, int maxHeight, String background, boolean square, boolean done)
      Description copied from interface: ThumbnailPolicyFilter
      This method is a hook called by Thumbnail tag to generate a thumbnail of the given FileDocument.
      Specified by:
      createThumbnail in interface ThumbnailPolicyFilter
      Parameters:
      doc - FileDocument of which to create a thumbnail
      dest - destination file (the thumbnail to generate)
      format - the format of the file to generate as requested by the ThumbnailTag
      maxWidth - the maximum width of the thumbnail to generate
      maxHeight - the maximum height of the thumbnail to generate
      background - the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight
      square - set to true to crop image into a square using the specified width during thumbnail creation.
      done - the global plugin createThumbnail() status
      Returns:
      true on success, or false if the thumbnail could not be created
      See Also:
    • createThumbnail

      public boolean createThumbnail(URL url, File dest, ImageFormat format, int maxWidth, int maxHeight, String background, boolean square, boolean done)
      Description copied from interface: ThumbnailPolicyFilter
      This method is a hook called by Thumbnail tag to generate a thumbnail of the given URL.
      Specified by:
      createThumbnail in interface ThumbnailPolicyFilter
      Parameters:
      url - the URL of which to create a thumbnail
      dest - destination file (the thumbnail to generate)
      format - the format of the file to generate as requested by the ThumbnailTag
      maxWidth - the maximum width of the thumbnail to generate
      maxHeight - the maximum height of the thumbnail to generate
      background - the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight
      square - set to true to crop image into a square using the specified width during thumbnail creation.
      done - the global plugin createThumbnail() status
      Returns:
      true on success, or false if the thumbnail could not be created
      See Also: