Last modified: 2014-06-05 21:51:10 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64881, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62881 - Add original dimensions information from the API to data-mw
Add original dimensions information from the API to data-mw
Status: NEW
Product: Parsoid
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized enhancement
: ---
Assigned To: C. Scott Ananian
:
Depends on:
Blocks: 54844
  Show dependency treegraph
 
Reported: 2014-03-20 18:15 UTC by Moriel Schottlender
Modified: 2014-06-05 21:51 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Moriel Schottlender 2014-03-20 18:15:28 UTC
Since Parsoid already runs an API call for each image given to it in wikitext, it would be extremely helpful for the editing in terms of user experience if the call also asked for the original dimensions.

At the moment, VisualEditor asks for details from the API on each edited image to get its original dimensions. When this is done for the edit dialog the asynchronous call works fine because we don't mind letting the user wait the seconds it takes the async call to finish.

But when the user resizes images with the mouse (with the resize handles) the information about original dimensions usually comes too late. The user may (and often does) resize the image to above its limits, and by the time VE gets the API response, the user is already done resizing. On top of that, calculating aspect ratio from original size is a lot more accurate than calculating it from the given (usually smaller) size, though, granted, this is a lot less crucial.

We have some fall backs and we are considering an after-the-fact user experience ideas to make this work, but it would be extremely helpful if the information was already available when it comes from Parsoid -- especially since Parsoid already asks for information from the API.
Comment 1 C. Scott Ananian 2014-03-20 18:24:52 UTC
I'm not convinced we should be bloating our Parsoid DOM representation with original size information which can easily be obtained from the imageinfo API.  In order to do a proper resize, you are probably going to have to fetch the original image anyway so that things don't get blurry when you scale up.

But I'm interesting in hearing other thoughts.
Comment 2 James Forrester 2014-03-20 18:56:08 UTC
(In reply to C. Scott Ananian from comment #1)
> I'm not convinced we should be bloating our Parsoid DOM representation with
> original size information which can easily be obtained from the imageinfo
> API.  In order to do a proper resize, you are probably going to have to
> fetch the original image anyway so that things don't get blurry when you
> scale up.
> 
> But I'm interesting in hearing other thoughts.

We don't fetch the original image unless the new size is the image's original dimensions – we ask MW for the thumbnail of that size. We certainly don't ask e.g. for a 10MiB original 5000x4000px image when the user is just resizing from 250x200px to 300x240px. Also, we fetch the new image /after/ the image is resized.
Comment 3 Trevor Parscal 2014-03-20 19:07:29 UTC
I do agree we should be careful, but I think this is worth including. It's really useful and costs very little.
Comment 4 C. Scott Ananian 2014-03-31 21:36:52 UTC
We have a new strategy for serializing square bounding boxes that will be helped by having original image size hanging around, so we will probably put original image size in data-mw.
Comment 5 Moriel Schottlender 2014-06-05 00:09:41 UTC
On top of the dimensions, it would also be helpful to get the 'mediatype' property of images, separating them between "DRAWING" and "BITMAP". The two types behave differently, especially with size considerations.

It is useful for VE to know (we request this now with our separate api call) but it might actually make sense to categorize the difference between the images for other purposes.
Comment 6 Gabriel Wicke 2014-06-05 21:51:10 UTC
The size concern also matters less once we move data-mw out of the DOM. There's still the minor nuisance of having some read-only attributes in data-mw, which is otherwise a read-write interface.

Maybe it would make sense to group dimensions & image type in a separate 'imageinfo' sub-object inside data-mw that is documented to be read-only. The grouping & naming should make it clearer that this is read-only info only, even without looking at the docs.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links