code: public static CmsImageScaler getDownScaler(CmsObject cms, String rootPath) {
  
          if (m_downScaler == null) {
              // downscaling is not configured at all
              return null;
          }
          // try to read the image.size property from the parent folder
          String parentFolder = CmsResource.getParentFolder(rootPath);
          parentFolder = cms.getRequestContext().removeSiteRoot(parentFolder);
          try {
              CmsProperty fileSizeProperty = cms.readPropertyObject(
                  parentFolder,
                  CmsPropertyDefinition.PROPERTY_IMAGE_SIZE,
                  true);
              if (!fileSizeProperty.isNullProperty()) {
                  // image.size property has been set
                  String value = fileSizeProperty.getValue().trim();
                  if (CmsStringUtil.isNotEmpty(value)) {
                      if (PROPERTY_VALUE_UNLIMITED.equals(value)) {
                          // in this case no downscaling must be done
                          return null;
                      } else {
                          CmsImageScaler scaler = new CmsImageScaler(value);
                          if (scaler.isValid()) {
                              // special folder based scaler settings have been set
                              return scaler;
                          }
                      }
                  }
              }
          } catch (CmsException e) {
              // ignore, continue with given downScaler
          }
          return (CmsImageScaler)m_downScaler.clone();
      }
docs: Returns the image downscaler to use when writing an image resource to the given root path.<p>
  
  If <code>null</code> is returned, image downscaling must not be used for the resource with the given path.
  This may be the case if image downscaling is not configured at all, or if image downscaling has been disabled
  for the parent folder by setting the folders property {@link CmsPropertyDefinition#PROPERTY_IMAGE_SIZE}
  to the value {@link #PROPERTY_VALUE_UNLIMITED}.<p>
  
  @param cms the current OpenCms user context
  @param rootPath the root path of the resource to write
  
  @return the downscaler to use, or <code>null</code> if no downscaling is required for the resource