001    package railo.runtime.functions.image;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.exp.PageException;
005    import railo.runtime.img.Image;
006    import railo.runtime.op.Caster;
007    
008    public class ImageScaleToFit {
009            
010            public static String call(PageContext pc, Object name,String fitWidth, String fitHeight) throws PageException {
011                    return call(pc, name, fitWidth, fitHeight, "highestQuality",1.0);
012            }
013            
014            public static String call(PageContext pc, Object name,String fitWidth, String fitHeight, String interpolation) throws PageException {
015                    return call(pc, name, fitWidth, fitHeight, interpolation,1.0);
016            }
017            
018            public static String call(PageContext pc, Object name, String fitWidth, String fitHeight, String strInterpolation, double blurFactor) throws PageException {
019                    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
020                    Image img = Image.toImage(name);
021                    img.scaleToFit(fitWidth, fitHeight, strInterpolation, blurFactor);
022                    return null;
023            }
024    }