Class ManageImageCache

java.lang.Object
org.adempiere.webui.util.ManageImageCache

public class ManageImageCache extends Object
Images can come from inside system or from outside system.
For images from outside, we will cache it for better performance.
This class is for management of image cache and provide related helper function.
Author:
hieplq
  • Field Details

    • log

      protected static final CLogger log
  • Constructor Details

    • ManageImageCache

      public ManageImageCache()
  • Method Details

    • instance

      public static ManageImageCache instance()
      Get singleton instance
      Returns:
      ManageImageCache instance
    • getImageInternalUrl

      public static URL getImageInternalUrl(MImage image)
      nvestigate path of MImage, if path is internal return internal url, otherwise return null.
      Parameters:
      image -
      Returns:
      URL of image or null
    • getImageInternalUrl

      public static URL getImageInternalUrl(String url)
      Investigate image path, if path is internal return internal url, otherwise return null.
      Parameters:
      url -
      Returns:
      URL of image or null
    • loadImageData

      protected static byte[] loadImageData(String imagePath)
      Load image from url
      Parameters:
      imagePath -
      Returns:
      image data
    • getImage

      public org.zkoss.image.Image getImage(String imagePath)
      If image is not in cache, load it (imagePath can be id of MImage).
      Parameters:
      imagePath -
      Returns:
      image from cache or loaded from path. null if there is exception in loading.
    • getImage

      public org.zkoss.image.Image getImage(URL url)
      Get image from URL or cache.
      Parameters:
      url -
      Returns:
      Image
    • loadImage

      public String loadImage(MImage mImage)
      If MImage has image URL or binary image data, load it into cache and return key (id or url). other return null
      Parameters:
      mImage -
      Returns:
    • loadExtend

      protected void loadExtend(String imagePath)
      load external image into cache
      Parameters:
      imagePath -