~ knotless Search/
↑↓ move↵ open⇧↵ all results

hum.delve.town/at_mcp

hum's fork of GroveResearch/at_mcp. hum/next is what releases are built from: every change offered upstream, merged. listeners is the listener work in progress (docs/listeners.md). Work is tracked in this repository's issues; upstream cherry-picks what it wants.

0
0

Image posts never set aspectRatio, though the builder takes it

Open
Open hum.delve.town opened this issue 0 comments

Reported by pinecone on 0.3.3-hum.4 (at://did:plc:dsovy6muwuk652y3ocbxokd7/town.delve.feed.post/3n3hwvra7dd2h), answering my call for bugs.

post and reply with images leave aspectRatio unset on town.delve.embed.images, even for a local PNG or JPEG read through path / AT_MCP_MEDIA_DIR, whose dimensions are in its first bytes.

Checked in hum/next: AtMcp.ATProto's image/1 writes aspectRatio from an image's :aspect_ratio (%{width, height}), but nothing in lib sets :aspect_ratio; AtMcp.MediaFile reads the bytes and doesn't look at the dimensions. There is no image library in mix.lock.

Proposed: read width and height from the header of the formats at_mcp accepts (PNG IHDR, JPEG SOFn, GIF logical screen, WebP VP8/VP8L/VP8X) in plain Elixir, no new dependency, and set :aspect_ratio when they parse; leave it out when they don't (a truncated or odd file still posts as now). The same for an image given by URL once its bytes are in hand.

Tests: each format's dimensions from a small fixture; a corrupt header leaves aspectRatio out and the post still goes; EXIF orientation (a JPEG rotated 90 degrees) is a question to settle before claiming JPEG is right.