Last modified: 2012-01-18 19:45:26 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 T28470, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26470 - Add toggle for checkered or transparent image background on file description pages
Add toggle for checkered or transparent image background on file description ...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal minor (vote)
: ---
Assigned To: DieBuche
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-12-28 23:26 UTC by MZMcBride
Modified: 2012-01-18 19:45 UTC (History)
13 users (show)

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


Attachments

Description MZMcBride 2010-12-28 23:26:07 UTC
Wikimedia Commons, the English Wikipedia, and hundreds of other sites have added this to their [[MediaWiki:Common.css]]:

/* Put a checker background at the image description page only visible if the image has transparent background */
/* You may want to clear the gallery background for the main namespace on other projects as galleries are used in articles */
#file img,
.filehistory a img,
.gallerybox .thumb img { background: url("http://upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png") repeat; }

It should be in core.
Comment 1 Platonides 2010-12-28 23:43:11 UTC
Added in r20065, removed in r20340.

The mentioned thread is http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/30603 dealing with users (which don't need a checker background) vs editors (for which it's useful).
Comment 2 Mark A. Hershberger 2011-01-29 00:33:05 UTC
Unless you want re-discuss this on WikiTech-l, I think it is clearly WONTFIX for now.
Comment 3 MZMcBride 2011-01-29 00:50:39 UTC
I started a discussion here: http://lists.wikimedia.org/pipermail/wikitech-l/2011-January/051447.html

As I said in the e-mail, there's definitely a missing functionality here: being able to figure out if an image background is white or transparent. Having this functionality in MediaWiki may already be filed in Bugzilla, but I don't know of any dupes off-hand.

This doesn't necessarily need to be implemented in site-wide CSS, but the functionality should exist in some sane format. Re-opening this for now.
Comment 4 MZMcBride 2011-01-30 18:37:22 UTC
Based on comments on the mailing list, a toggle on the file description page (with a sensible global default that can be customized per-project) seems like the best solution to this problem. It balances the needs of editors with the needs of readers.

I've updated this bug's summary accordingly from "Add checkered background to transparent image backgrounds" to "Add toggle for checkered or transparent image background on file description pages". I've also added the "easy" keyword, as I don't think implementing this would be very difficult.
Comment 5 p858snake 2011-01-31 07:07:48 UTC
Probably wouldn't be that hard with some jquery magic to add some css (background image) onto the div...
Comment 6 Erwin Dokter 2011-02-01 10:57:53 UTC
I like the toggle idea on the image description page, provided the history images remain transparent. Users should also be able to set a default in their preferences (under Appearence).
Comment 7 Waldir 2011-02-01 15:29:11 UTC
Instead of JavaScript, how about a pure css solution, changing the background to checkered on hover? That'd be cleaner, simpler and make the verification of background transparency even faster than clicking a toggle link/button.
Comment 8 Krinkle 2011-02-03 01:02:49 UTC
(In reply to comment #7)
> Instead of JavaScript, how about a pure css solution, changing the background
> to checkered on hover? That'd be cleaner, simpler and make the verification of
> background transparency even faster than clicking a toggle link/button.

Not bad at all, but when manually scanning a category or gallery page, having to hover each to see if and how an image is transparent would not be very user friendly.

I'd suggest making a preference dropdown:
* Apply checkered background on hover [CSS :hover { background } ]
* Don't apply checkered backgrounds []
* Apply checkered backgrounds by default [CSS { background} ]

Still no javascript required. and a small bit of css is added/removed (the same way the css for stub articles is dynamically loaded in a special way).

Alternatively, if this would fragment cache (not sure if it does, I don't expect it will) - we could opt for a pseudo-javascript implementation, in which the preference is set and can be retrieved via javascript ( mw.user.options.get('checkedbackground') ), and then css can be added on-load by a core module (ie. mediawiki.js or mediwiki.util.js)
Comment 9 Erwin Dokter 2011-02-03 02:08:16 UTC
Are galleries and categories subject of this discussion? I was under the impression that only the main image on an image description page should be toggled.
Comment 10 Platonides 2011-02-08 23:30:25 UTC
(In reply to comment #8)
> Alternatively, if this would fragment cache (not sure if it does, I don't
> expect it will)

It wouldn't.
Comment 11 Mark A. Hershberger 2011-02-17 00:19:36 UTC
*** Bug 27458 has been marked as a duplicate of this bug. ***
Comment 12 Mark A. Hershberger 2011-02-17 15:11:20 UTC
*** Bug 27458 has been marked as a duplicate of this bug. ***
Comment 13 Erwin Dokter 2011-05-20 23:17:00 UTC
On second thought, I'm not so sure if adding yet more preferences is good thing.

It seems the hover toggle is the way to go. (Not on galleries though, just the main image; enwiki uses transparency only on non-article galleries.) A hover toggle is as simple as adding ":hover" to common.css, and maybe moving the CSS to core all together.
Comment 14 DieBuche 2011-07-08 19:58:03 UTC
I'll take this one.
Comment 15 DieBuche 2011-07-08 20:35:21 UTC
(In reply to comment #13)
> On second thought, I'm not so sure if adding yet more preferences is good
> thing.
Totally agreed.

> It seems the hover toggle is the way to go. (Not on galleries though, just the
> main image; enwiki uses transparency only on non-article galleries.) A hover
> toggle is as simple as adding ":hover" to common.css, and maybe moving the CSS
> to core all together.
Done in r91756
Comment 16 Erwin Dokter 2011-07-08 22:44:14 UTC
Reverted in r91761, therefor reopened.

As Krinkle commented, we need to flesh out how this should be done. Since many sites already have transparency set in their CSS, this patch would not have worked reliably anyway. I think we should leave the choice the the respective sites on what they want to do with their CSS.

I tried the hover CSS for some weeks, but that isn't quit it either. A more elegant solution would be to have some image toolbar/applet above the image, styled after the edit toolbar, that can toggle tranparency combined with toggling the checkered background and even choose background color, and store it's settings as a cookie. That should be easy to achieve.
Comment 17 DieBuche 2011-07-08 23:00:05 UTC
(In reply to comment #16)
> Reverted in r91761, therefor reopened.
> 
> As Krinkle commented, we need to flesh out how this should be done. Since many
> sites already have transparency set in their CSS, this patch would not have
> worked reliably anyway. I think we should leave the choice the the respective
> sites on what they want to do with their CSS.
> 
> I tried the hover CSS for some weeks, but that isn't quit it either. A more
> elegant solution would be to have some image toolbar/applet above the image,
> styled after the edit toolbar, that can toggle tranparency combined with
> toggling the checkered background and even choose background color, and store
> it's settings as a cookie. That should be easy to achieve.

AFAIK it's hard to impossible (maybe using canvas?) to detect whether an image has an alpha channel via JS.
And showing the toolbar on every non-transparent image is rather irritating (because it won't do anything)
Comment 18 Erwin Dokter 2011-07-08 23:39:38 UTC
I had not considered that.
Comment 19 Bawolff (Brian Wolff) 2011-07-09 01:53:52 UTC
>AFAIK it's hard to impossible (maybe using canvas?) to detect whether an image
>has an alpha channel via JS.
>And showing the toolbar on every non-transparent image is rather irritating
>(because it won't do anything)

I really do not like that idea. Remember how annoying the IE image toolbar was (maybe thats just me). I do not think that would be good usability, even if used only on transparent images. (Also, things that only appear on some images without being appearent why, especially tooltip things, are annoying too. See the title on links bug and the controversy that caused)

>Since many
>sites already have transparency set in their CSS, this patch would not have
>worked reliably anyway. I think we should leave the choice the the respective
>sites on what they want to do with their CSS.

Why not. The C in CSS stands for cascading. I do not think we should care about weird hacks wikis do unless they cause severe incompatibility (which this doesn't. At worse on hover the background would change to a different transparent image). Most mediawiki users (outside of Wikimedia) will not know enough to do custom css stuff.


(for reference, I think the hover on file pages only solution is a good idea)
Comment 20 Erwin Dokter 2011-07-09 17:49:52 UTC
I wa thinking more about a static bar above the image, not the kind that pops up like in IE.

I know what the C stands for. The reason why it may not work is because local CSS overrides the CSS in core. Enwiki now has a static bg-image; placing a hover in the core CSS will be overridden by that static bg-image. But that is indeed not a big issue.

I am asuming that the scope of this bug is the image description page only, so transparency outside of the image description page (such as galleries in non-article space) are not considered.

On the image description page, there are two elements: the main image, and the thumbnails in the history table. I propose we make main image transparent on hover, and the history thumbs permanently transparent. That would done as follows:

/*
 * Add a checkered background image on hover for file description pages.
 */
.filehistory a img,
#file img:hover {
    /* @embed */
    background: white url(images/Checker-16x16.png) repeat;
}

This basically means the previous patch had one 'hover' too many.
Comment 21 DieBuche 2011-07-27 12:05:05 UTC
(In reply to comment #20)
> /*
>  * Add a checkered background image on hover for file description pages.
>  */
> .filehistory a img,
> #file img:hover {
>     /* @embed */
>     background: white url(images/Checker-16x16.png) repeat;
> }
> 
> This basically means the previous patch had one 'hover' too many.

Fine with me. Anyone against it? Otherwise I'll commit that in a few days.
Comment 22 Krinkle 2011-07-31 05:59:45 UTC
Looks good to me.

People who only need to know "if" an image is transparent can either scroll down or hover the image, and for more precision the hover on the main image on the description page can be used.

It will not show transparency on articles, which I think is a good thing.
Comment 23 MZMcBride 2011-09-03 03:48:15 UTC
(In reply to comment #21)
> (In reply to comment #20)
>> /*
>>  * Add a checkered background image on hover for file description pages.
>>  */
>> .filehistory a img,
>> #file img:hover {
>>     /* @embed */
>>     background: white url(images/Checker-16x16.png) repeat;
>> }
>> 
>> This basically means the previous patch had one 'hover' too many.
> 
> Fine with me. Anyone against it? Otherwise I'll commit that in a few days.

Bump.
Comment 24 Antoine "hashar" Musso (WMF) 2011-09-05 06:29:13 UTC
Patch resend with r96270.
Since it is kind of a new feature, it will be in 1.19.
Comment 25 Saibo 2012-01-18 19:29:18 UTC
Project or user css:
How can we get it like it was before (checkered background on the file page permanently)?  Would it also be possible to invert the hover action?  Ie: white/page background on hover?
Comment 26 Erwin Dokter 2012-01-18 19:45:26 UTC
Permanent checkered background:

#file img {
    /* @embed */
    background: white url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat;
}

Reverse hover:

#file img {
    /* @embed */
    background: white url(//upload.wikimedia.org/wikipedia/commons/5/5d/Checker-16x16.png) repeat;
}
#file img:hover {
    background: white;
}

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


Navigation
Links