getImageSize
Back to ListDescription: Get image size, return as JSON object
FileMaker Prototype:
Set Variable [$res; ACF_Run("getImageSize"; string_path)]
Category: UTILITY
Function source:
function getImageSize ( string path )
string basepath = regex_replace("^(.+)/(.+\..+)$", path, "\1");
string filename = regex_replace("^(.+)/(.+\..+)$", path, "\2");
string commands, result;
array string params, dim;
if ( file_exists (path)) then
commands = "identify " +filename ; // Outputs image details
result = SystemCommand(commands, basepath);
params = explode (" ", trimboth(result));
result = params[3]; // Image size
dim = explode ("x", result);
return JSON ("w", int(dim[1]), "h", int(dim[2]), "name", filename);
else
return "";
end if
end
