Jack000 / Expose

A simple static site generator for photoessays
MIT License
4.39k stars 257 forks source link

Add support for JPG Image AutoRotation #11

Closed hutcheon closed 9 years ago

hutcheon commented 9 years ago

Optional image auto-rotation. Properly accounts for the rotation in the dimensions sent to the templates.

Jack000 commented 9 years ago

so there are a few issues with this patch. On mac at least the -a operator has problems, which is why I use the

if [ foo ] && [ bar ] 

form for conditionals.

Also the result from

identify -format "%[EXIF:Orientation]" "$image"

may not return anything at all if there is no exif data. And the default orientation is not limited to 1. I think here we want to whitelist specific vertical codes - 5, 6, 7, 8 to swap width and height values

aside from that, I think this is a great way to resolve the autorotation issue.

hutcheon commented 9 years ago

Interesting, I didn't know bash on Mac differed. Good idea on the exif vertical orientation codes, for the life of me I couldn’t find a good list.

Jack000 commented 9 years ago

almost there! There's a typo in one of the orientation conditionals (-n $orienation) also I'd wrap $orientation in quotes just in case

hutcheon commented 9 years ago

Oh man, I'm on the ball today :( Fixed the typo. Though I already had the quotes.