/** * Returns the scaling height for the image.<p> * * @return the scaling height for the image */ public String getHeight() { return String.valueOf(m_scaler.getHeight()); }
/** * Returns the scaling height for the image.<p> * * @return the scaling height for the image */ public String getHeight() { return String.valueOf(m_scaler.getHeight()); }
int height = target.getHeight(); int width = target.getWidth(); height = Math.round(getHeight() * scale); } else if ((height > 0) && (getHeight() > 0)) { float scale = (float)height / (float)getHeight(); width = Math.round(getWidth() * scale); } else if (isValid() && !target.isValid()) { height = getHeight(); height = getHeight(); } else if ((target.getHeight() > 0) && (getHeight() < height)) {
/** * Returns a new image scaler that is a width based down scale from the size of <code>this</code> scaler * to the given scaler size.<p> * * If no down scale from this to the given scaler is required because the width of <code>this</code> * scaler is not larger than the target width, then the image dimensions of <code>this</code> scaler * are unchanged in the result scaler. No up scaling is done!<p> * * @param downScaler the image scaler that holds the down scaled target image dimensions * * @return a new image scaler that is a down scale from the size of <code>this</code> scaler * to the given target scaler size */ public CmsImageScaler getWidthScaler(CmsImageScaler downScaler) { int width = downScaler.getWidth(); int height; if (getWidth() > width) { // width is too large, re-calculate height float scale = (float)width / (float)getWidth(); height = Math.round(getHeight() * scale); } else { // width is ok width = getWidth(); height = getHeight(); } // now create and initialize the result scaler return new CmsImageScaler(downScaler, width, height); }
/** * Returns a new image scaler that is a width based down scale from the size of <code>this</code> scaler * to the given scaler size.<p> * * If no down scale from this to the given scaler is required because the width of <code>this</code> * scaler is not larger than the target width, then the image dimensions of <code>this</code> scaler * are unchanged in the result scaler. No up scaling is done!<p> * * @param downScaler the image scaler that holds the down scaled target image dimensions * * @return a new image scaler that is a down scale from the size of <code>this</code> scaler * to the given target scaler size */ public CmsImageScaler getWidthScaler(CmsImageScaler downScaler) { int width = downScaler.getWidth(); int height; if (getWidth() > width) { // width is too large, re-calculate height float scale = (float)width / (float)getWidth(); height = Math.round(getHeight() * scale); } else { // width is ok width = getWidth(); height = getHeight(); } // now create and initialize the result scaler return new CmsImageScaler(downScaler, width, height); }
public int doStartTag() throws JspException { if ((m_scaler.getWidth() <= 0) && (m_scaler.getHeight() <= 0)) { throw new JspException("At least one of the attributes width or height has to be set");
/** * Creates a new image scaler based on the given HTTP request.<p> * * The maximum scale size is checked in order to prevent DOS attacks. * Without this, it would be possible to request arbitrary huge images with a simple GET request, * which would result in Out-Of-Memory errors if the image is just requested large enough.<p> * * The maximum blur size is checked since this operation is know to also cause memory issues * with large images. If the original image is larger then this, no blur is applied before * scaling down, which will result in a less optimal but still usable scale result.<p> * * @param request the HTTP request to read the parameters from * @param maxScaleSize the maximum scale size (width or height) for the image * @param maxBlurSize the maximum size of the image (width * height) to apply blur */ public CmsImageScaler(HttpServletRequest request, int maxScaleSize, int maxBlurSize) { init(); m_maxBlurSize = maxBlurSize; String parameters = request.getParameter(CmsImageScaler.PARAM_SCALE); if (CmsStringUtil.isNotEmpty(parameters)) { parseParameters(parameters); if (isValid()) { // valid parameters, check if scale size is not too big if ((getWidth() > maxScaleSize) || (getHeight() > maxScaleSize)) { // scale size is too big, reset scaler init(); } } } }
/** * Creates a new image scaler based on the given HTTP request.<p> * * The maximum scale size is checked in order to prevent DOS attacks. * Without this, it would be possible to request arbitrary huge images with a simple GET request, * which would result in Out-Of-Memory errors if the image is just requested large enough.<p> * * The maximum blur size is checked since this operation is know to also cause memory issues * with large images. If the original image is larger then this, no blur is applied before * scaling down, which will result in a less optimal but still usable scale result.<p> * * @param request the HTTP request to read the parameters from * @param maxScaleSize the maximum scale size (width or height) for the image * @param maxBlurSize the maximum size of the image (width * height) to apply blur */ public CmsImageScaler(HttpServletRequest request, int maxScaleSize, int maxBlurSize) { init(); m_maxBlurSize = maxBlurSize; String parameters = request.getParameter(CmsImageScaler.PARAM_SCALE); if (CmsStringUtil.isNotEmpty(parameters)) { parseParameters(parameters); if (isValid()) { // valid parameters, check if scale size is not too big if ((getWidth() > maxScaleSize) || (getHeight() > maxScaleSize)) { // scale size is too big, reset scaler init(); } } } }
scaler.setHeight(downScaler.getHeight()); scaler.setWidth(downScaler.getWidth());
scaler.setHeight(downScaler.getHeight()); scaler.setWidth(downScaler.getWidth());
jsonObj.put("height", scaler.getHeight()); } else { jsonObj.put("height", -1);
jsonObj.put("height", scaler.getHeight()); } else { jsonObj.put("height", -1);
scaledImage.setSrcUrl(OpenCms.getLinkManager().substituteLink(cms, imageSrc)); scaledImage.setWidth(m_scaler.getWidth()); scaledImage.setHeight(m_scaler.getHeight()); scaledImage.setScaler(m_scaler);
if (((scaler.getHeight() <= 0) || (scaler.getWidth() <= 0)) || ((scaler.getType() == 5) && scaler.isValid() && !scaler.isCropping())) {
int width = -1; if (scaler.isValid()) { height = scaler.getHeight(); width = scaler.getWidth();