Last modified: 2010-11-04 03:37:24 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 T14649, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12649 - Show metadata information from SVGs on file description page
Show metadata information from SVGs on file description page
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.12.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-16 02:36 UTC by Thomas Thurman
Modified: 2010-11-04 03:37 UTC (History)
4 users (show)

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


Attachments
Add ability to show metadata to SVGs (8.62 KB, patch)
2008-01-16 02:36 UTC, Thomas Thurman
Details

Description Thomas Thurman 2008-01-16 02:36:20 UTC
Created attachment 4550 [details]
Add ability to show metadata to SVGs

Inkscape and other SVG editors let you add a ton of useful metadata to SVGs which duplicates the stuff that we currently put on the image page.

Example:
http://commons.wikimedia.org/wiki/Image:Asl_alphabet_gallaudet_ann.svg
contains the licence, language, author, description, etc.

The attached patch does two things:

 1) adds the ability to show SVG metadata on image pages, and

 2) renames wgShowEXIF to wgShowImageMetadata. But I'm not sure how to auto-detect this as we did before, so it's hardcoded to 1 instead for the moment.
Comment 1 Thomas Thurman 2008-01-16 03:00:00 UTC
Other things I need to fix up, looking over it again:

* The equivalent function for finding the height and width of an SVG uses a regex and not an XML parser; I need to write a comment explaining why an XML parser is really needed here

* I think everyone uses the "cc" and "dc" prefix for those namespaces, but really we need to ask the XML parser to turn them back into the full namespace names for disambiguation

* something elsewhere requires getMetadataType() to return "exif" when there's useful information; we should fix that and not just work around it here

* I need to find out all the URLs for all the licences.
Comment 2 Brion Vibber 2008-01-16 03:35:50 UTC
A warning -- XMLReader isn't included in PHP 5.0, and while it's enabled by default in 5.1 it's possible that not all distro builds include it.

If it's not convenient to rewrite it to the uglier event-based XML parser, you should ensure that the functionality degrades gracefully when the extension class isn't present.


+                              wfMsg('license='.$xml->getAttribute('rdf:resource')));
[snip]
+'license=http://web.resource.org/cc/PublicDomain' => 'Public domain',

^^ That's probably not such a good idea; while it might work at the moment, you can reasonably expect it to break. Message keys shouldn't contain arbitrary URLs...

This technique will also show really ugly output for anything not already thought of and added to a list. It might be better to show a nicely formatted default instead for unknown values.
Comment 3 Thomas Thurman 2008-01-16 04:40:50 UTC
Good point: I'll use a hash table to map the licence URLs to unique identifiers in the i18n table, and something similar will do very nicely for mapping the namespace names to unique identifiers too.

What sort of nicely formatted output are you thinking of? It looks something like

    <svgmeta-foobar>     42

at the moment.
Comment 4 Daniel Friesen 2008-01-16 06:37:48 UTC
What about XPath?

There's a PHP Library on Sourceforge which does XPath fairly nicely. You can find things inside of a XML document giving it the text of the document, and it works on PHP 4 through 5 without dependencies on any of the XML libraries.

http://sourceforge.net/projects/phpxpath/
Comment 5 Thomas Thurman 2008-01-16 12:56:53 UTC
That's a really good plan, and would make everything much cleaner. I'll give it a whirl.
Comment 6 Derk-Jan Hartman 2010-11-04 03:37:24 UTC
Basics for metadata collection are now in r75968.

Still needs a lot of work though. I held off on the RDF parsing, because I'd first like to see the new metadata branch merged into trunk.

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


Navigation
Links