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?
so?:
local function whatOrientation ( imageID )
local variableName = photo:getRawMetadata('croppedDimensions')
local outPutName = nil
if variableName.width > variableName.height then
outPutName = "landscape"
else
outPutName = "portrait"
end
if variableName.width == variableName.height then
outPutName = "square"
end
return outPutName
end
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.
my goal is to set each thumbnail generated from the web gallery with a class selector for my css styles. I think what i am looking to do would be best setup in javascript but i would love if lightroom (lua in this case) can take some of the load off. so in the end i might have a gallery with 20 images, and 20 thumbnails, each thumbnail depending on its orientation I would set the selector when the gallery is generated. Any theory where to start or where I should be calling this function.
thanks again for responding,
Ryan
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.
North America
Europe, Middle East and Africa
Asia Pacific