> and it has been suggested that tiddlers (up to a certain style) are > delivered with base64 data URI as the tiddler.text and fields > containing any extra required metadata. A tiddler type attribute would > identify what the tiddler text describes? For example the tiddler type > might be image/xml+svg and the tiddler text might be the source code, > or alternatively it might be image/png and the tiddler text might be a > data uri. Viewing an image tiddler in normal TiddlyWiki might show > gobbledygook but with the addition of a plugin/adaption of the > wikifier clicking on the tiddler would show the image it represents in > place of the text.
See: http://www.TiddlyTools.com/#AttachFilePackage In particular, http://www.TiddlyTools.com/#AttachFileSample uses native TW *section* syntax to define 3 possible sources for the 'attached' binary content: * a local path/file reference, * a remote URL, * base64-encoded data These 3 potential sources are used for multi-tiered fallback handling by http://www.TiddlyTools.com/#AttachFilePluginFormatters which extends the TW pretty link and image syntax ([[text|...]] and [img[...]], respectively) to permit use of 'attachment tiddler' titles in place of the usual external path/file or URL reference. The enhanced formatters first look for base64-encoded data stored in the specified tiddler. If no encoded data is present (or you are using IE, which doesn't support the data:// URI syntax), then the formatter looks for a local path/file. If the file is not found (or no local reference is defined for the attachment), then the external URL reference is used. If the URL is not defined (or isn't a valid address), the browser's normal 'broken image' display handling takes over. Note that, because attachment tiddlers use ***TW-native section syntax***, you can easily edit it as needed by employing the standard TW editor, without needing any custom fields at all. It also makes it easy to embed the content of individual sections into other tiddlers by using TW standard <<tiddler TiddlerName##sectionname>> syntax. In addition, the section syntax is very portable: you can copy an attachment tiddlers (and the AttachFilePluginFormatters 'runtime') to any other TW document In fact, once you have embedded base64-encoded image data in a tiddler, it can be embedded directly into the document's [[StyleSheet]] to define CSS background images, without using ANY plugins at all! For example, you can write: body { background-image: url('[[MyBackground##data]]'); } to embed the encoded data:// URI directly into the StyleSheet. Of course, this usage simply assumes that the encoded data is present in the attachment (and is supported by the browser) and completely bypasses the 3-tier fallback mechanism provided by AttachFilePluginFormatters. In contrast, when the enhanced formatters ARE installed, then you can omit the "##data" portion from the StyleSheet reference and just refer to the attachment tiddler itself, and allow the plugin's fallback handling to do the rest: body { background-image: url('[[MyBackground]]'); } Another advantage of the 3-tier fallback approach is that it allows for efficient distribution of documents with external images: * send a document, with embedded data, for totally self-contained use * send a much smaller document using file-based attachments, along with the accompanying set of image files for offline/local viewing * or send the document but *not* the image files, and allow the attachment formatters to use a remote fallback URL where you have posted the images online. enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
