roadrunnertwice: Dialogue: "I have caught many hapless creatures in my own inter-net." (Hapless creatures (Rainy Days))
Nick Eff ([personal profile] roadrunnertwice) wrote in [site community profile] dw_dev2019-11-27 05:21 pm

Help brainstorm ways to make images misbehave

A while back, I submitted a patch that sometimes shrinks images within post and comment bodies, to make sure they fit inside their container and fit on a single screen.

It seems to mostly be working, but there's also times when you don't WANT it to work; for example, it's perfectly fine for a long vertical comic strip to flow off the page.

So I'm messing with a way to let people click-to-zoom on individual images!

»» Here's the demo. ««

That demo has several different cases I thought about — for example, I'm not enabling click-to-zoom for images that are links, because links already do something when you click on them (and most of the time it's "go to the full size image" anyway). I'm also not zooming poll bar graph images, because those are special and weird.

Anyway, the trick with this is to make it do what people want most of the time, but hopefully never do anything really nonsensical. So I need help thinking of things that people do with images in their posts/comments that might cause nonsense, and then I can figure out which nonsense to mitigate and which nonsense to just accept. The only ones I came up with so far are:

  • If an image didn't need to shrink, it gets a "click to zoom" cursor on hover but it doesn't actually do anything.
  • If someone used the width="x" / height="x" attributes to make an image bigger than its natural size, the zoom cursor hints will be reversed (i.e. "zoom in" will actually shrink it).

What else have you got?

siderea: (Default)

[personal profile] siderea 2019-11-28 02:45 am (UTC)(link)
Wait. I'm confused about the fundamental premise. How does your patch effect image size? Adding width/height image tags to the HTML? Serving a different sized image than the one called by the src attribute? Something in the CSS?

(FWIW, I have a whole bunch of posts with an egregious number of images in them, and those images are mostly in tables, and if this is useful to you...? You could take copies I guess? See https://siderea.dreamwidth.org/tag/influenza1918 Content advisory: mass death.)
siderea: (Default)

[personal profile] siderea 2019-11-28 06:03 am (UTC)(link)

Oooo, very cool! So the idea is that if someone has an irritatingly wide image in one's reading page, one can click the button and all the images are constrained to the column width? (Or on an image-by-image basis?)

jducoeur: (Default)

[personal profile] jducoeur 2019-12-03 06:25 pm (UTC)(link)
Concept makes sense, but the demo is broken -- looks like Markdown formatting is turned off, or some such...
jducoeur: (Default)

[personal profile] jducoeur 2019-12-03 07:36 pm (UTC)(link)
Yep, looks generally right to me. If straightforward, I would suppress the `+` mouse pointer if the image is already at 100% (it's a bit misleading, suggesting that if you click it will zoom), but I think it's an improvement as-is...