Page MenuHomePhabricator

Web performance: texvc math images do not specify width and height attributes
Closed, DeclinedPublic

Description

The <img> tags generated by our math module do not list the width or height; this can delay page rendering while the image is loaded, or cause the page to reflow and jump around after the loading is complete:

<img class="tex" alt="E_k \approx \frac{N (\Delta p)^2}{2m} \approx \frac{N \hbar^2 n^{2/3}}{2m} \approx \frac{M^{2/3} N^{5/3} \hbar^2}{2m R^2}." src="http://upload.wikimedia.org/math/b/7/e/b7e74c9f6c091d2c1e157e29381a5132.png" />

Note we probably need to change the math table so we actually record the size...


Version: unspecified
Severity: enhancement
URL: http://en.wikipedia.org/wiki/White_dwarf
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=68295

Details

Reference
bz20202

Event Timeline

bzimport raised the priority of this task from to Low.
bzimport set Reference to bz20202.
brion created this task.Aug 12 2009, 10:11 PM

chinchi29 wrote:

Specifying this will change the rendering behavior?

Kind of, the browser whilst reading the page source and loading it will know the dimensions and then reserve that area till the image loads (or fails depending on the browser).

TheDJ added a comment.May 26 2013, 8:29 PM

On the MathTexvc's callTexvc(), run php's getimagesize() on the temp file result. (we need field 0 and field 1)

Get connection to master, write values in new column(s)
Read these values from slave in getMathImageHTML()

http://php.net/manual/en/function.getimagesize.php

physik wrote:

@TheDJ: Are you still woking on this? I wanted to clean up old bugzilla messages.

TheDJ added a comment.Apr 17 2014, 2:43 PM

no, i'm not working on it, but i still think we should add it.

generate file, use phpimagesize, store values in db, use them in generated html.

Change 129974 had a related patch set uploaded by TheDJ:
Math: Retrieve dimensions of math images

https://gerrit.wikimedia.org/r/129974

TheDJ added a comment.Apr 27 2014, 4:22 PM

Done mostly as a proof of concept now

Change 144939 had a related patch set uploaded by Physikerwelt:
Add width and height to SVG image

https://gerrit.wikimedia.org/r/144939

Change 144939 merged by Frédéric Wang:
Add width and height to SVG image

https://gerrit.wikimedia.org/r/144939

fredw added a comment.Jul 26 2014, 2:39 PM

(In reply to Gerrit Notification Bot from comment #9)

Change 144939 merged by Frédéric Wang:
Add width and height to SVG image

https://gerrit.wikimedia.org/r/144939

This is really only for the SVG images. The PNG still need some width/height attributes, IIUC.

Change 129974 abandoned by Physikerwelt:
Math: Retrieve dimensions of math images

Reason:
conserved in https://www.mediawiki.org/wiki/Extension:Math/Roadmap#Bugs_and_Roadmap_and_random_thoughts_.28From_the_discussion_page.29 feel free to restore if any development on that is planned

https://gerrit.wikimedia.org/r/129974