Last modified: 2014-02-12 23:45:23 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 T38198, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36198 - Article images are blurry on retina display (Responsive images)
Article images are blurry on retina display (Responsive images)
Status: RESOLVED FIXED
Product: MobileFrontend
Classification: Unclassified
Feature requests (Other open bugs)
unspecified
All All
: Normal enhancement
: ---
Assigned To: Brion Vibber
:
: 32096 35844 (view as bug list)
Depends on:
Blocks: hidpi
  Show dependency treegraph
 
Reported: 2012-04-24 02:04 UTC by Tomasz Finc
Modified: 2014-02-12 23:45 UTC (History)
11 users (show)

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


Attachments

Description Tomasz Finc 2012-04-24 02:04:18 UTC
Loading http://en.m.wikipedia.org/wiki/Union_Square,_San_Francisco shows a very blurry image for "View of Union Square" on a retina display. Tapping through the image detail page shows a high quality image with the same physical dimensions.

As Preilly points out ... this is because we load 
http://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Union_square_san_francisco.jpg/250px-Union_square_san_francisco.jpg while the detail page loads shttp://upload.wikimedia.org/wikipedia/commons/a/a5/Union_square_san_francisco.jpg
Comment 1 Tomasz Finc 2012-04-24 02:08:55 UTC
Second link should have been

http://upload.wikimedia.org/wikipedia/commons/a/a5/Union_square_san_francisco.jpg
Comment 2 Jon 2012-04-24 13:10:09 UTC
This is a tricky problem
There are libraries that deal with this http://css-tricks.com/foresight-js/ but
adding a library might be overkill for such a thing

There are also various techniques we can use to serve the correct images
including these:
http://24ways.org/2011/adaptive-images-for-responsive-designs
http://24ways.org/2011/adaptive-images-for-responsive-designs-again

I don't know enough about how we choose the images to serve to comment any
further on this... but we must bear in mind that an image loads as soon as it
is encountered in markup.

I had a little play myself with another idea which was to wrap images in a
noscript tag and use some javascript to provide better resolution photos:
http://jonrobson.me.uk/wikipedia/adaptive-images.html
Comment 3 Jon 2012-09-18 05:28:28 UTC
*** Bug 35844 has been marked as a duplicate of this bug. ***
Comment 4 Brion Vibber 2012-09-18 05:58:59 UTC
*** Bug 32096 has been marked as a duplicate of this bug. ***
Comment 5 Brion Vibber 2012-09-18 06:00:53 UTC
Adding tracking bug 32101.

Note that this issue affects the desktop site as well these days, with both tablets and laptops existing with 2.0x ratios (Apple's "Retina" iPad and MacBook Pro) and more 1920x1080 Android and Windows tablets and laptops coming soon.

I'll see if I can devise a clean way to add a secondary image source or something...
Comment 6 Brion Vibber 2012-09-18 07:24:10 UTC
I've got some general info at [[mw:HiDPI_display_support]] which I'll refresh shortly with updated documentation on best practices, etc.

Went ahead with a test implementation of responsive images for the desktop site:
https://gerrit.wikimedia.org/r/#/c/24115/

* adds $wgResponsiveImages setting, defaulting to true, to enable the feature
* adds jquery.hidpi plugin to check window.devicePixelRatio and replace images with data-src-1-5 or data-src-2-0 depending on the ratio
* adds mediawiki.hidpi RL script to trigger hidpi loads after main images load
* renders images from wiki image & thumb links at 1.5x and 2.0x and includes data-src-1-5 and data-src-2-0 attributes with the targets

Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload.

Confirmed basic images and thumbs in wikitext appear to work in Safari 6 on MacBook Pro Retina display.



The same little jQuery plugin could be called from MobileFrontend as well, and should work though I haven't tested that yet.
Comment 7 Brion Vibber 2012-10-05 19:47:43 UTC
This patch has evolved a bit since the above, now uses HTML5 'srcset' attribute and does the JS replacement magic only if native srcset support is not found.

Also runs on DOM-ready rather than onload, so fewer images should end up with double-loading.

Still waiting on full review:
https://gerrit.wikimedia.org/r/#/c/24115/ - core
https://gerrit.wikimedia.org/r/#/c/24147/ - MobileFrontend

Also tweaks for MobileFrontend icons:
https://gerrit.wikimedia.org/r/#/c/26570/
Comment 8 Arthur Richards 2012-10-12 18:17:05 UTC
All changes have been merged. Marking as fixed.

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


Navigation
Links