Creating External Images en masse?

590 views
Skip to first unread message

Petrus

unread,
Aug 17, 2018, 5:10:39 PM8/17/18
to TiddlyWiki
Is there a way to add multiple External Images at once similar to how the standard import function adds several embedded images with drag & drop.

Using the standard image embed function on dozens or hundreds of images turns my TiddlyWiki into a several gigabyte behemoth and manually adding that many is out of the question.

Zachary Storer

unread,
Aug 17, 2018, 5:57:05 PM8/17/18
to TiddlyWiki
This seems somewhat related to a previous post of mine: https://groups.google.com/forum/#!topic/tiddlywiki/fqL7a9rIoTc.
Basically, from what I gather, this is a feature that needs to be added by developers. I'll let others confirm this however.

Jed Carty

unread,
Aug 17, 2018, 6:09:39 PM8/17/18
to TiddlyWiki
Developers in this case means browser developers, not tiddlywiki.

I did make a plugin that lets you set what the folder with images is and then when you import an image instead of importing the image it creates a tiddler with a canonical uri field. For now it is only set up to work with Bob. https://github.com/OokTech/TW5-ServerImages

Mark S.

unread,
Aug 17, 2018, 6:12:58 PM8/17/18
to TiddlyWiki
Here's one approach.

OF COURSE, ALWAYS START BY MAKING SURE YOU HAVE A BACKUP OF YOUR TW FILE!!

Using an advanced text editor like Emacs, get a list of your images and put it into a format like this:

CIMG2199.JPG: x
CIMG2200
.JPG: x
CIMG2201
.JPG: x
CIMG2202
.JPG: x

Paste this into a tiddler called "MyImages" and change the type to data dictionary. Save the tiddler.

Create another tiddler with the following contents:

\define gluepath() $(path)$$(image)$
<$set name="path" value="file:///D:\data\graphics\file-us\">

<$button>Make Image Tiddlers
<$list filter="
[[MyImages]indexes[]]" variable="image">
<$action-createtiddler $basetitle=<<image>> _canonical_uri=<<gluepath>> type="
image/jpeg">
</$list>
</$button>

</$set>


Change the "path" variable to whatever address is needed for image directory and system (I used file:/// but you don't need that for images positioned relative to your system).

Click on the "Make Image Tiddlers" button, and a "Image Tiddler" (_canonical_uri based) will be made for each image.

You can of course play with this to use other image dictionaries, paths, etc. A similar technque could be used to generate image wikitext if you don't like Image Tiddlers. Note that if you are on windows that you can't use drive names like C: in the data dictionary (that's why I applied the path outside the dictionary).

HTH
-- Mark
Reply all
Reply to author
Forward
0 new messages