I need to know what the aspect ratio of an image is so i can apply css properties to it depending on it being square, landscape, or portrait. is there a propery that will return this information?
local function whatOrientation ( imageID )
local variableName = photo:getRawMetadata('croppedDimensions')
local outPutName = nil
if variableName.width > variableName.height then
outPutName = "landscape"
outPutName = "portrait"
if variableName.width == variableName.height then
outPutName = "square"
then use it in the galleryinfo.lrweb somewhow?
I am beyond new to using lua, and have a 15 year ago background in C that was never continued so I am way out of practice.
thanks again for responding,
You probably want to have outputName set to something valid, unless the caller can handle nil. LrPhoto:getRawMetadata() can return nil, as well, so you might want to check for nil before trying to use it.
Also, note that LrPhoto:getRawMetadata() will need to be called from within an LrTask, either one you create yourself, or one provided by the SDK context you are running this in.
Europe, Middle East and Africa