I should mention that I DO have some guidance when the image is 90 or -90 degrees off: the height and width of the image do not match the scaled-down heights and widths of the original images (data that comes in the metadata).
The "previews:getImage" function in Elare Plugin Framework has a boolean parameter named 'orient'.
Try reversing it (set it to true if it was false, or false if it was true).
Note: the freshest code for the framework comes from any newly released plugin of mine, the released framework package is getting kinda stale..
Background: previews are already oriented (without any metadata), so if you apply orientation metadata afterward, then they are "over-oriented" (oriented wrong).
i wasn't using previews:getImage, so i don't know how i would have made that work. in any case, photo:getDevelopSettings ().orientation seemed to do the trick. it produces two-letter strings depending on the rotation that will need to be applied to the unrotated thumbnails:
AB-- no need to rotate
BC-- need to rotate 90 degrees
CD -- need to rotate 180 degrees
DA -- need to rotate 270 (or -90) degrees
my thumbnails are ultimately being uploaded to a website, and i was able to use this info to apply CSS transforms to thethumbnails so they would be oriented properly. thanks guys for your help!
Judas Gutenberg wrote:
i don't know how i would have made that work.
* download elare plugin framework (or any of my plugins that uses it).
* call previews:getImage function, and set orient param as appropriate.
* recode Previews:getImage function to divorce from elare plugin framework.
PS - there are 8 codes total - the other 4 include permutations with horizontal and vertical flip.
An example code excerpt:
if orient == 'AB' then -- unflipped/unrotated, or its flipped & rotated equivalent. -- degrees = 0 - for purposes here, no need to rotate if 0 degrees. return elseif orient == 'BC' then p = "Rotate 90 CW" -- CW required. elseif orient == 'CD' then p = "Rotate 180" -- must not include a "CW" suffix. elseif orient == 'DA' then p = "Rotate 270 CW" -- must be CW. elseif orient == 'BA' then -- flipped horizontal, no rotation. p = "Mirror Horizontal" elseif orient == 'AD' then -- ", 90 p = "Mirror Horizontal and Rotate 90 CW" elseif orient == 'DC' then -- ", 180 (which is equivalent to flipped vertically). p = "Mirror Vertical" elseif orient == 'CB' then -- ", 270 p = "Mirror Horizontal and Rotate 270 CW" else app:callingError( "^1 has '^2' db-orientation, which is not yet supported - please report error: ", str:to( self.file ), orient ) end