Page MenuHomePhabricator

Safe, simple <img> wrapper (for external images)
Open, LowPublicFeature

Description

Author: eep

Description:

  • Allow full <img> HTML tag attributes for "alt="/"title=" descriptions, "border=", dimensions/resolutions ("width=", "height="), and full CSS customization ("style=", "class=")
  • A way to limit this variable to certain domains and even directories (and all subdirectories) of a particular domain (such as the one the wiki is on) to prevent abuse

Version: unspecified
Severity: enhancement
See Also: T56144 T56306

Details

Reference
bz10809

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:52 PM
bzimport set Reference to bz10809.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

We don't support <img> in core for the simple reason that it's not wiki text; $wgAllowExternalImages is a convenience option.

I wouldn't object to an extension which does this.

There are two problems with the images shown in response to $wgAllowExternalImages=true

  1. there is no simple way to have their size ajusted,
  2. there is no [[...|thumb|...]] option.

The latter can be overcome (imho well enough) by placing the image URL as a parameter into a template call, and have the template take care of proper formatting. Of course, such templates duplicate an effort aready made elsewhere. While this works fine for images being small enough, it becomes excessively complicated when it comes to size adjustments.

Such adjustment could be made by putting an image into a container, and have common.css say something similar to:

.scaleimage.img { width:100% }

effectively asking browsers to skale the image to the width of its container, which has to be a block element having class="scaleimage" (just an untested thought)

I suggest:

A. *IF* it is easy to allow [[ ... |thumb| ... ]] to be fed with an URL in addition to Image:..., then add a switch which permits it, or let $wgAllowExternalImages=true enable it.

B. So as to ease CSS-styling of externally embedded images, add somthing like class="externalimage" to the generated <img ... /> tags. Currently, there is no class attribute.

gwicke is working on a <domparse> wrapper which might be a good building block for extensions which want to embed raw HTML.

GOIII set Security to None.
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM