-
Improvement
-
Resolution: Unresolved
-
Normal
-
None
-
None
In a similar way to what is doing Discogs (e.g. http://api.discogs.com/releases/1508127)
This would be both convenient and would save bandwidth since currently you have to download the image to get its size,
and then thrown it away if you consider it's too small for your usage.
- is a dependency of
-
MBS-5507 Small Cover Art images have 500px and 250px links
-
- Blocked
-
-
MBS-6641 Display resolution and file size of cover art uploads
-
- Open
-
-
MBS-6097 Show dimensions of Cover Art Archive images
-
- Closed
-
-
MBS-4701 Add width and height attributes to CAA images in edits display
-
- Blocked
-
-
MBS-5139 Display picture size (image size) in cover art edits
-
- Blocked
-
Spot on! The main thing the script does it creating a HTML img element and polling until the browser sets the naturalWidth and naturalHeight properties, and cancelling the image load afterwards. All of this usually happens quite quickly, since the browser can get the necessary information from the image file's headers, without having to download an entire 40MB PNG. Some additional things it does are getting the file size from IA's metadata API, and in case of PDF files, the page count by counting the number of files in a ZIP file derived by the IA. The script also has some caching functionality with IndexedDB to save some time on subsequent visits.
All that being said, I'm not sure whether any of this could help towards including this information in the CAA API responses, unless it's implemented on the server side (which, as I discussed in MBS-6641, seems undesirable). And even if it does get implemented on the server side, there would probably be better ways to do it, since you'd no longer be constrained to a browser environment.
However, as far as I know, there's nothing technically blocking this from being integrated on the client side. Integrating this into MBS' client side would unblock MBS-5507, MBS-6641, MBS-4701, and MBS-5139, as well as possibly other tickets. Unfortunately, I currently don't have the bandwidth to integrate it myself (and I don't know React), but the userscript code is MIT-licensed, so anyone is free to reuse whatever parts might be useful, and I'd of course be happy to help where I can. The only thing I'd ask for is some attribution.