Become a fan of Slashdot on Facebook



Forgot your password?
Close
binspam dupe notthebest offtopic slownewsday stale stupid fresh funny insightful interesting maybe offtopic flamebait troll redundant overrated insightful interesting informative funny underrated descriptive typo dupe error
1023 journal
User Journal

Journal pbhj's Journal: data:image/svg+xml and the hCard format (buzz-alicious!)

Journal by pbhj
Inspired by an entry by Brian Suda at http://microformats.org/wiki/hcard I tried creating a hCard with an SVG entry as a data URL at the contacts page of my paint your own pottery studio Barefoot Ceramics (http://barefoot-ceramics.com.nyud.net:8090/find).

The original entry was:

"Brian Suda has managed to embed a photo in his hCard through the data uri scheme (http://www.ietf.org/rfc/rfc2397.txt) by converting the image to BASE64 code. View the Source to see how this is accomplished. The X2V link {REMOVED} will extract the image and encode it for a vCard which will be displayed in some address book applications."

My hCard now has this element:

<img class="photo" style="display:none;" src="data:image/svg+xml;text,<?xml version='1.0' encoding='UTF-8' standalone='no'?><svg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.0' width='50' height='80' id='svg3957'><defs id='defs3959' /><path d='M 28.91433,{...CODE CUT...}32.192802 z' style='fill:#cc4d00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.625;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1' id='path9551' /></svg>" alt="Barefoot">

Does it work?? Well it parses OK. Some automated tools replace the < with %3C (etc., eg Brian Suda's vcard form). Unfortunately Kontact (KDE contacts tool) doesn't handle SVG as a vCard photo or logo format (indeed it crashes if you try to import the card a second time once it's already installed) - I don't know if this is a standard. It seems it could work and maybe even does somewhere.

What was quite cool was the use of the SVG or base64-SVG directly in the URL. If you check the coral cache you can look at the page source and try pasting this in to your browsers address bar. It works at least in FF1.5, Konq3.4 and Seamonkey1 on Linux but hasn't been tested on other platforms.

Opera8 fails to handle the first self-closing tag and so can't parse the XML properly. Opera9 hangs indefinitely but works (as do those above) with the data:url content as base64 encoded text. I suspect MSIE won't do this.

There was very little about data urls with SVG (Google:0, Yahoo:25, A9:20), but http://groups.google.com/groups?q=%22data%3Aimage%2Fsvg%2Bxml%22 turned up 3 pages that sum up the rest of it really.
This discussion has been archived. No new comments can be posted.

data:image/svg+xml and the hCard format (buzz-alicious!)

Comments Filter:

There may be more comments in this discussion. Without JavaScript enabled, you might want to turn on Classic Discussion System in your preferences instead.

Slashdot Top Deals

[引用]

It's been a business doing pleasure with you.

Close
Working...

AltStyle によって変換されたページ (->オリジナル) /