eight04 / image-picka

A Firefox/Chrome extension helping you download images.
MIT License
171 stars 19 forks source link

Which element is downloaded from a <picture> element? #307

Closed vigilantesculpting closed 1 year ago

vigilantesculpting commented 2 years ago

Background: Some websites will use a <picture> element with a number of different <source> elements, which allows the browser (desktop vs mobile for example) to display the appropriately scaled image to the user for that picture. As a fallback, the picture element always has an <img> element as a last resort, typically with the original resolution image. Image Picka seems very capable of downloading these picture element images (the feature was added in 0.9.0 according to the changelog).

Question: Right now it seems that Image Picka will download the first <source> image (usually the lowest resolution one) when presented with a <picture> element. Is it possible that it can always download the <img> element instead?

EDIT: fixed up the brackets in the text

eight04 commented 2 years ago

https://github.com/eight04/image-picka/blob/6a05e976ea111ab6a5ea719cd176071c1a0caf39/src/lib/image-util.js#L57-L62

We should probably collect all sources and find the largest one.

vigilantesculpting commented 2 years ago

I'll see what I can do to help, with the debugger.