Getting Images Into node.js Tiddlywiki

91 views
Skip to first unread message

Kevin Kleinfelter

unread,
Sep 20, 2017, 12:25:19 PM9/20/17
to TiddlyWiki
I'm trying to migrate from TWC to TW5.  I'm struggling to get my library of .png images into my node.js Tiddlywiki.  With TWC, I had my html file in a folder, my images in a sub-folder named images, and I referenced them with [img[./images/image-name.png]].

After reading assorted postings, some suggesting that I would have to spin up an additional web server to bring images into TW5, I had almost despaired.

Then I learned that I could simply move my existing .png files into the "tiddlers" folder and create similarly named .meta files, with something like:

created: 20170920155658912
modified: 20170920155658912
title: image-name.png
type: image/png

in them, and I can use the familiar [img[image-name.png]] syntax to reference them.

That's not so bad.  Copy image files to new TW, write a script to manufacture .meta files.  Restart node.js so that it notices the new "tiddlers" (image files). Easy enough.

Is it possible to put these images in a sub-folder of the "tiddlers" folder with TW5?   How?  Do I put the .meta file in the sub-folder with the image?  Do I put it in the "tiddlers" folder, and reference the image file in the sub-folder?
TIA

Kevin Kleinfelter

unread,
Sep 20, 2017, 1:05:24 PM9/20/17
to TiddlyWiki
Solved my own question.  The .meta file goes in the images sub-folder, along with the .png file, but the .meta file specifies the path to the png file FROM THE "tiddlers" folder.  i.e.
title: images/image-name.png

lives in the .meta file in the images folder.  It specifies the path that it is in, not the path from the folder it is in.

Mark S.

unread,
Sep 20, 2017, 2:53:51 PM9/20/17
to TiddlyWiki
If you use tiddlyserver, it will serve up images so your original img syntax should work. Your meta technique looks interesting, though. I didn't think node by itself could do images at all.

Good luck,
Mark
Reply all
Reply to author
Forward
0 new messages