001 package railo.runtime.functions.image; 002 003 import railo.commons.lang.ExceptionUtil; 004 import railo.runtime.PageContext; 005 import railo.runtime.exp.FunctionException; 006 import railo.runtime.exp.PageException; 007 import railo.runtime.img.Image; 008 import railo.runtime.op.Caster; 009 import railo.runtime.type.Struct; 010 011 public class ImageGetEXIFTag { 012 013 public static Object call(PageContext pc, Object name, String tagName) throws PageException { 014 if(name instanceof String) name=pc.getVariable(Caster.toString(name)); 015 Image img = Image.toImage(name); 016 017 Struct data = ImageGetEXIFMetadata.getData(img); 018 Object value = data.get(tagName, null); 019 if(value==null){ 020 throw new FunctionException(pc, "ImageGetEXIFTag", 2, "tagName", ExceptionUtil.similarKeyMessage(data.keysAsString(),tagName,"tag","tags")); 021 } 022 return value; 023 } 024 025 }