code: public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) {
  
          if (scaleParam != null) {
              CmsImageScaler cropScaler = null;
              // use cropped image as a base for scaling
              cropScaler = new CmsImageScaler(scaleParam);
              if (scaler.getType() == 5) {
                  // must reset height / width parameters in crop scaler for type 5
                  cropScaler.setWidth(cropScaler.getCropWidth());
                  cropScaler.setHeight(cropScaler.getCropHeight());
              }
              scaler = cropScaler.getCropScaler(scaler);
          }
          // calculate target scale dimensions (if required)
          if (((scaler.getHeight() <= 0) || (scaler.getWidth() <= 0))
              || ((scaler.getType() == 5) && scaler.isValid() && !scaler.isCropping())) {
              // read the image properties for the selected resource
              if (original.isValid()) {
                  scaler = original.getReScaler(scaler);
              }
          }
          return scaler;
      }
docs: Creates the images scaler used by this image tag.<p>
  
  @param scaler the scaler created from this tags parameters
  @param original a scaler that contains the original image dimensions
  @param scaleParam optional scaler parameters for cropping
  
  @return the images scaler used by this image tag