Page MenuHomePhabricator

Use a better method for detecting STL files on the page
Closed, ResolvedPublic

Description

Currently we look for img[src$=stl.png]. This could be broken by uploading a file called 2d.airport.diagram.stl.png, which leads to weird behaviour.

It would be better if the parser added an appropriate class to 3D thumbnails instead. One could then add the 3D badge using a CSS-only solution.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Ramsey-WMF moved this task from Untriaged to Next up on the Multimedia board.

@brion Are you saying that's a blocker to this task?

See also T204621 for another reason why this is important.

Not a blocker, but it'd be nice to treat various media types consistently in that respect. Ought to be able to add a custom class on the <img> in some reasonable way already, though...

@Esanders worst case, currently should be possible to override the ThreeDHandler's doTransform method to return a custom ThumbnailImage subclass, which can add a class by sniping into the toHtml() method and appending to the img-class entry in options.

Sounds icky but I think it'll work. :D

Change 461403 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/3D@master] Fix 3D thumbnail HTML in PHP

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

Change 461403 merged by jenkins-bot:
[mediawiki/extensions/3D@master] Fix 3D thumbnail HTML in PHP

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