Server-side orientation of a cached thumbnail data URI.
Drive renders a thumbnail in the page's own orientation, so a landscape
document (documentStyle.flipPageOrientation) comes back wider than tall.
The admin grids show every thumbnail in a fixed portrait frame with
object-fit: cover anchored to the top, which would crop a landscape page
to its middle strip; img_style/1 switches such an image to contain.
The decision is made here from the image header rather than in an onload
handler: LiveView's DOM patch rewrites a JS-mutated style attribute back to
the rendered one on the next re-render (and onload does not fire again for
an unchanged src), and a host Content-Security-Policy: script-src 'self'
blocks inline handlers outright.
Only the header is decoded. PNG, GIF, WebP and baseline/progressive JPEG are
recognised — the four types GoogleDocsClient stores. Anything else reads as
portrait, which is the frame's original behaviour.
Summary
Functions
{:ok, {width, height}} read from the header of a base64 image data URI,
or :error when it isn't one or the format isn't recognised.
Inline style for a thumbnail <img> inside a fixed portrait frame.
Whether the image in data_uri is wider than it is tall.
Functions
@spec dimensions(term()) :: {:ok, {pos_integer(), pos_integer()}} | :error
{:ok, {width, height}} read from the header of a base64 image data URI,
or :error when it isn't one or the format isn't recognised.
Inline style for a thumbnail <img> inside a fixed portrait frame.
Whether the image in data_uri is wider than it is tall.