I have created a Tiddlywiki which allows me to view thumbnails of external images. Each image is a tiddler with a _canonical_uri field. The images are in a folder named images which is in the same parent folder as the wiki.
I can select individual thumbnail images using a checkbox and create a json array JsonImportList of those images that I want to import into my wiki.
Unsurprisingly, it does not import the images; instead tiddlers with the full path as their title are created.
I assume that the JSON array must have just the image file names and not the full paths, but how do incorporate the path to the files into the above code?
You can already view external images in TW and you wish to import selected image files into TW file ? I’m afraid “tm-import-tiddlers” doesn’t do that, nor any TW commands. It can’t be SCRIPTED using TW alone, because of browser security. Don’t want random external site you browse to to be able to import your local images using script without you knowing.
Note that importing images directly into TW is generally discouraged because images are huge compared to TW file and can cause TW file bloat. External image links are recommended instead.
However :
You can do it MANUALLY. By dragging and dropping an image into TW, even an external image displayed in your TW, like what you already have. You can also multi-select image files from you OS file manager* and drag them into TW.
* I’m not sure if and how TW can support multi-select and dragging of images displayed within itself.
TiddlyClip is a browser and TW plugin that allows you to clip images and text directly from web page into TW. I suppose there is nothing stopping TiddlyClip from clipping external images displayed within TW before pasting into TW itself
I have been able to create external image tiddlers using the method described here:
The images to be imported are first listed in a data dictionary. Note that the code contains a small error - the action-createtiddler element is not closed, it should be:
I think my original request was unclear. I actually want to import the selected images in my JSON array as internal images.
The images to be imported are downsized so storage is not a problem.
For context, the wiki is a travel blog which I allow friends and family to download. Internal images removed the need for them to also download a separate folder of images.
Rob as mentioned elsewhere, the import button uses the $browse widget (not well named) see $:/core/ui/Buttons/import then review https://tiddlywiki.com/#BrowseWidget this is the way to customise the FILE import process as well. use the multiple attribute And by default the deserializer is derived from the file extension or type eg .jpg files.
Here is an example I use for non-image files
\whitespace trim
<span class="tc-file-input-wrapper browse-button">
<$browse multiple accept={{!!extensions}} tooltip={{{ [[Search for and Import one or more files with the extensions]] [{!!extensions}] +[join[ ]] }}}/>
{{!!caption}}
</span>
The extensions field contains .json, .tid, .txt, .csv to which you could add/replace *.jpg