I wasn’t sure if you’re aware that you can easily store image data in arbitrary fields, using data uris. And there are a plethora of tools to convert images to data uris.
This shows a single tiddler that has three images included as field data.
title: Internal Images
asterisk: data:image/svg+xml,%3Csvg%20...
logo: data:image/png;base64,iVBORw0K...
venn: data:image/svg+xml,%3C%3Fxml%2...
!! These are SVG images, encoded as Data URIs in fields of this tiddler:
!!! Field `venn`
<$image source={{!!venn}} width="300px" />
!!! Field `asterisk`
<$image source={{!!asterisk}} width="300px"/>
!! And this is a logo for SVG (ironically formatted as a PNG, then converted to a Data URI):
!!! Field `logo`:
<$image source={{!!logo}} width="300px"/>
Perhaps because the only advantage I see to it is that of packing more information into a single tiddler, which generally runs afoul of the Philosophy of Tiddlers. If you don’t need to pack the information together, then separate image tiddlers are more easily found and reused. However, as Charlie points out, there are times when packed individual tiddlers are quite useful.
Yes…, although this “philosophy of tiddlers” norm is always contextual, right? Something should get its own tiddler if it is likely to be called upon for re-use, if it needs to be separately searchable, etc. In a wiki devoted to students, however, it would make sense to put the profile pic for a student into that tiddler — when the image “belongs” quite directly to a tiddler, it’s easier to transclude it as a tiddler-field pair than to try to remember whatever other naming scheme one might have for image-associated-with-x… and also one doesn’t have to think separately about whether dragging a tag-pill-worth of tiddlers might leave something behind that in some sense “belongs” to them.
At any rate, I’m looking forward to experimenting with this!
It is worth saying why Tiddlers are “context dependent” …
… the underlying architecture of TW means (in extremis) a Tiddler could be …
— A word like “A”
or …
— An entire document like the biblical “Genesis”
The criterion for “appropriate” Tiddlerisation will rest upon the “FOR-ness” the maker is aspiring to.
And a magic in TW is the ability to use TW, in its own self-instance, to recursively chunk / combine Tiddlers using Tiddlers to produce Tiddlers. Ad infinitum.
There is your FOR-ness.
It makes complete sense to have one Tiddler per student profile. The “profile” is the “unit”.
However IF I had a student who was excellent at homework should that be signalled in another “award” Tiddler? Or IF Igor Igor was absent during your important penultimate tutorial—“new censure Tiddler or not?”
I guess this is partly about HOW to convert workable “administrative routines” into TW “fors?”
The more I think about this, the more I agree. I have done too much unnecessary work with naming schemes. And for several wikis where I use member images, so far they look like this:
title: Scott Sauyet
tags: Member
avatar: ScottSauyet.jpg
...
While the rule that converts "Scott Sauyet" to "ScottSauyet.jpg" is easy enough to implement, and while currently that’s done outside TW as I generate these members from an external source, I really have no need for for the separate image tiddler. Every place it’s used now is in the context of the member tiddler. So inlining seems to harm nothing, and reduces my tiddler count.
The best thing is that I have to change no wiki code whatsoever to switch to these inlined images. I hadn’t thought about it when I posted the above, but <$image source={{!!avatar}}> works whether avatar is a data uri or the name of another tiddler.
When I get time, I will see if I can create a field editor that allows an image file upload or drop and stores it as a data uri. That would make this quite convenient.
Aren’t data uris quite a bit larger than the original image? Probably wouldn’t be as much of an issue with nodejs tiddlywikis, but standalone wikis would probably not benefit from data uris, unless they are used sparingly.
FF on windows 11 could deal with data up to ~30MByte and it started to report illegal strings a bit above that.
Edge seemed to handle ~50MByte well, and started to complain about something above 100MB. But I could not replicate that behaviour. So I’m not sure here.
So mobile browsers may have other limits. – But I did not test that
It’s less than double. In base64 encoding, there are four bytes for every three in the input, with a small amount of additional overhead for the data uri shell. This is reduced by not having a separate tiddler (plus a .meta tiddler) for them, but only a field.
So yes, they will be somewhat larger. But only for Node.js. Because when they are used in a single-file wiki, they need to be converted to text anyway, which (I’m assuming) also uses base64.