use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ImageGetEXIFTag method call.
public static Object call(PageContext pc, Object name, String tagName) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
// ImageGetEXIFMetadata.getData(img);
Struct data = img.info();
Object value = data.get(tagName, null);
if (value == null) {
throw new FunctionException(pc, "ImageGetEXIFTag", 2, "tagName", ExceptionUtil.similarKeyMessage(data, tagName, "tag", "tags", null, true));
}
return value;
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ImageResize method call.
public static String call(PageContext pc, Object name, String width, String height, String interpolation, double blurFactor) throws PageException {
// image
// if(name instanceof String)name=pc.getVariable(Caster.toString(name));
Image image = Image.toImage(pc, name);
interpolation = interpolation.toLowerCase().trim();
if (blurFactor <= 0.0 || blurFactor > 10.0)
throw new FunctionException(pc, "ImageResize", 5, "blurFactor", "argument blurFactor must be between 0 and 10");
// MUST interpolation/blur
// if(!"highestquality".equals(interpolation) || blurFactor!=1.0)throw new ExpressionException("argument interpolation and blurFactor are not supported for function ImageResize");
image.resize(width, height, interpolation, blurFactor);
return null;
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ImageSetDrawingAlpha method call.
public static String call(PageContext pc, Object name, double alpha) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
if (alpha < 0 || alpha > 1)
throw new FunctionException(pc, "ImageSetDrawingAlpha", 2, "alpha", "alpha must be a value between 0 and 1");
img.setAlpha((float) alpha);
return null;
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ImageSetDrawingTransparency method call.
public static String call(PageContext pc, Object name, double percent) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
if (percent < 0.0 || percent > 100.0)
throw new FunctionException(pc, "ImageSetDrawingTransparency", 2, "percent", "value must be between 0 and 100");
img.setTranparency((float) percent);
return null;
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ImageSharpen method call.
public static String call(PageContext pc, Object name, double gain) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
if (gain < -1.0 || gain > 2.0)
throw new FunctionException(pc, "ImageSharpen", 2, "gain", "value must be between 1 and 2");
img.sharpen((float) gain);
return null;
}
Aggregations