About importing multiple image tiddlers at once

156 views
Skip to first unread message

Bruno Top Tiro Rocha Lima

unread,
Feb 28, 2020, 5:36:11 PM2/28/20
to TiddlyWiki
Anyone here know how to import multiple images as external images tiddlers?
I have an subfolder in my tiddly wiki, but is too laborous import manually every single file, once i just wanna they keep external, becouse i need to work with too many images.

TonyM

unread,
Feb 28, 2020, 5:46:13 PM2/28/20
to TiddlyWiki
I believe Bob may have such a feature.

If not already using it install the bobexe and generate the tiddlers then move them with link changes to any wiki.

Regards
Tony

Joshua Fontany

unread,
Feb 28, 2020, 7:15:27 PM2/28/20
to TiddlyWiki
You want the "tiddlywiki.files" meta-data import method. I just worked this out for a folder of Csv files like so:

In the wiki's `tiddlers` folder, create a new folder to hold the images (this separates the batch-loaded files from your `_system` and `wiki` tiddlers).

In the new folder, create a text file named `tiddlywiki.files` with the following content, modified to replace ".csv" with your image extensions, your own prefix, and the right `type` field for the images.
```
{
    "directories": [
        {
            "path": "./",
            "filesRegExp": "^.*\\.csv$",
            "isTiddlerFile": false,
            "fields": {
                "title": {"source": "basename-uri-decoded", "prefix": "Csv/"},
                "created": {"source": "created"},
                "modified": {"source": "modified"},
                "type": "application/csv",
                "tags": ""
            }
        }
    ]
}

```


Best,
Josh F

Mat

unread,
Feb 29, 2020, 6:32:21 AM2/29/20
to TiddlyWiki
Bruno Top Tiro Rocha Lima wrote:
Anyone here know how to import multiple images as external images tiddlers?
I have an subfolder in my tiddly wiki, but is too laborous import manually every single file, once i just wanna they keep external, becouse i need to work with too many images.

That's a very reasonable request, particularly considering how we advise against importing actual images into TW because of file size. It should be possible to select a set of images in some OS window and dragn'drop them into TW somehow without actually importing the files.

Drag'nDropping from the OS window onto the green import area lists the files for full import but there could be some sniffer tool that senses if they are images and asks of one wants the files or merely if _canonical_uri tids should be created.

I tried to DnD into a tiddler editor but this, to my surprise, didn't give anything. I was expecting to see the titles as strings there, upon dropping them, but really hoping it would be titles+paths. If this worked, one could make a macro to traverse through such a fields list and create a tiddler with a _canonical_uri field for each.

Does anyone know if it is reasonable to request that DnD from an OS window into an editor should give a list of file paths? Or is there some "obvious" reason why this doesn't already work? Is it purely a browser issue? Or maybe it does work in other OS'es than Windows?

<:-)

Jeremy Ruston

unread,
Feb 29, 2020, 6:55:26 AM2/29/20
to tiddl...@googlegroups.com

Does anyone know if it is reasonable to request that DnD from an OS window into an editor should give a list of file paths? Or is there some "obvious" reason why this doesn't already work? Is it purely a browser issue? Or maybe it does work in other OS'es than Windows?

This comes up surprisingly frequently. When dragging and dropping, browsers do not expose the original file location; JS code just sees the filename and content.

TiddlyDesktop supports the external attachments plugin which does what you want: on TiddlyDesktop we have access to the file path and so can create _canonical_uri tiddlers to point to imported tiddlers. You can install the plugin from the official plugin library.

Best wishes

Jeremy.

Mat

unread,
Feb 29, 2020, 8:45:27 AM2/29/20
to TiddlyWiki
Jeremy Ruston wrote:

Does anyone know if it is reasonable to request that DnD from an OS window into an editor should give a list of file paths? Or is there some "obvious" reason why this doesn't already work? Is it purely a browser issue? Or maybe it does work in other OS'es than Windows?

This comes up surprisingly frequently.

I assume that's because it is still somewhat iffy to work with images in TW, both to import or to draw them.

 
When dragging and dropping, browsers do not expose the original file location; JS code just sees the filename and content.

OK, but neither DnD'ing a single file nor multiple files into an editor(!) yields anything (except space characters). If it worked, it would be simple to add a path to them, or use a default path to some default folder so _canonical_uri tids could easily be created via DnD. This can be contrasted with an image on a webpage where its url can be directly DnD'd into the editor to get an url string there. (It also works to DnD one file, including full path, from "file:///C:/Users/....")


TiddlyDesktop supports the external attachments plugin which does what you want: on TiddlyDesktop we have access to the file path and so can create _canonical_uri tiddlers to point to imported tiddlers. You can install the plugin from the official plugin library.

That'd be for @Bruno who posted the OP. (Personally, I mostly use TiddlySpot for the majority of my wikis so I can't use local filepaths anyway - but it would be neat if it were possible to pull in an image link, e.g http:....jpg and it was recognized so the created tiddler was a _canonical_uri with the url.... but this is another question.)
 
<:-)

Jeremy Ruston

unread,
Feb 29, 2020, 9:07:00 AM2/29/20
to tiddl...@googlegroups.com
Hi Mat

On 29 Feb 2020, at 13:45, Mat <matia...@gmail.com> wrote:

Jeremy Ruston wrote:

Does anyone know if it is reasonable to request that DnD from an OS window into an editor should give a list of file paths? Or is there some "obvious" reason why this doesn't already work? Is it purely a browser issue? Or maybe it does work in other OS'es than Windows?

This comes up surprisingly frequently.

I assume that's because it is still somewhat iffy to work with images in TW, both to import or to draw them.

That might be worth another thread. Drawing an image is one click if one has the “new image” button in the sidebar, hard to imagine it being much simpler. In what way is it iffy to import images (besides the browser restrictions we’re discussing here)?

OK, but neither DnD'ing a single file nor multiple files into an editor(!) yields anything (except space characters).

The system handles drag and drop into text inputs. We could override the behaviour but we still wouldn’t have access to the filepath except on platforms like TiddlyDesktop.

If it worked, it would be simple to add a path to them, or use a default path to some default folder so _canonical_uri tids could easily be created via DnD.

It would certainly be useful to be able to drag a file into a TW5 text box and get a link or embed for that file, it’s not something that’s been suggested before, perhaps because it would only be useful with the external-attachments plugin.

But I’m confused why you suggest using it to create _canonical_uri tiddlers when that is already catered for by the external-attachments plugin?

This can be contrasted with an image on a webpage where its url can be directly DnD'd into the editor to get an url string there. (It also works to DnD one file, including full path, from "file:///C:/Users/....")

Indeed, browsers file:/// view of directories have some interesting capabilities that can certainly be useful.

TiddlyDesktop supports the external attachments plugin which does what you want: on TiddlyDesktop we have access to the file path and so can create _canonical_uri tiddlers to point to imported tiddlers. You can install the plugin from the official plugin library.

That'd be for @Bruno who posted the OP. (Personally, I mostly use TiddlySpot for the majority of my wikis so I can't use local filepaths anyway - but it would be neat if it were possible to pull in an image link, e.g http:....jpg and it was recognized so the created tiddler was a _canonical_uri with the url.... but this is another question.)

Given the URL on the clipboard one could indeed probably make creating a _canonical_uri tiddler be a a matter of one or two clicks.

Best wishes

Jeremy

 
<:-)

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d534d6c7-4aef-43fa-9d71-2ce11975f7a5%40googlegroups.com.

Mark S.

unread,
Feb 29, 2020, 12:43:57 PM2/29/20
to TiddlyWiki


On Saturday, February 29, 2020 at 3:55:26 AM UTC-8, Jeremy Ruston wrote:
TiddlyDesktop supports the external attachments plugin which does what you want: on TiddlyDesktop we have access to the file path and so can create _canonical_uri tiddlers to point to imported tiddlers. You can install the plugin from the official plugin library.



On my windows setup, the image names start with ../ , which would put them in a folder above the current directory. They have to be
hand-edited to remove the ../. (v. 0.0.13)

Thanks!


TonyM

unread,
Feb 29, 2020, 7:28:07 PM2/29/20
to TiddlyWiki
Mark & Jeremy,

I understand how browsers do not have access to the local paths, but the user does, a simple workaround is to set the path manually, and then drag from that location such that the path is appended to the image name and as long as the user ensures these match its fine. The part that needs automating is importing bulk image names, even if we must a folder at a time, but I believe relative folders below are permitted.

Especially with tiddlywiki we must always remember the strongest part of the system is the human and their rights to the local computer, not only the browsers right to the system.

Regards
Tony

Mark S.

unread,
Feb 29, 2020, 8:57:53 PM2/29/20
to TiddlyWiki
Sometimes I get this sense of deja vu


Sometimes I get this sense of deja vu.

Jeremy Ruston

unread,
Mar 2, 2020, 4:34:29 AM3/2/20
to tiddl...@googlegroups.com
Hi Mark

On my windows setup, the image names start with ../ , which would put them in a folder above the current directory. They have to be
hand-edited to remove the ../. (v. 0.0.13)

I'd be grateful if you could file an issue on GitHub for this, thanks.

Best wishes

Jeremy


Thanks!


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages