Import question

64 views
Skip to first unread message

History Buff

unread,
May 12, 2021, 1:33:51 PM5/12/21
to TiddlyWiki
Hello all,

I am building a TW to organize all of our family photos. So far, I've been doing everything by hand which is a tad tedious. I'm wondering if there might be a way to use the import mechanism a little differently than what I think is currently available (at least as far as I have found).

What I would like to do is to click an import button which would pull up a file picker. I would then pick my image that I wanted to use, but instead of importing the image as an external image tiddler, I would like to basically only import a path to the image such that I can use that path in creating my own external links and formatting them any way that I choose. I don't know enough about the import mechanism yet to understand if this is even possible or how to go about it.

Any thoughts or ideas?

Many thanks in advance.

Michael Wiktowy

unread,
May 12, 2021, 3:00:59 PM5/12/21
to TiddlyWiki
There is some complications with a tiddlywiki on an http:// site and displaying file:// type URLs but so long as the tiddlywiki is on your filesystem, it can display both http:// and file:// URIs.

I put together a convenience tool for making canonical_uri tiddlers and tagging them for future sorting. So just open up the local directory of images in a browser window (file:///<home directory of pictures>) and then you can drag and drop the links one at a time into the zone that DropCanonicalURI sets up. It will assign the mime-type that you set and tag the resulting tiddler with the name of the tidder that contains the macro. Browsers are not picky about the specific image type so long as you select one with the "image/" prefix ... so with a mix of jpgs and pngs, you should be able to just pick one and go with it. If I had the time, I could likely make it more clever and pick a good guess at a mime-type based on file extension ... but for now it is manual.

The ListHere macro and DropHere functionality might be useful to use in conjunction with this for further sorting/tagging/displaying. The DropHere isn't a macro unto itself since you would want to wrap it around some element that you want to make into a dropzone. But the example inside should get to going.

Hope you can put these to some use.

/Mike

History Buff

unread,
May 12, 2021, 4:40:27 PM5/12/21
to TiddlyWiki
Thanks Mike,

I'll take a look at what you've done and will see if it can be adapted to my needs. One question I have right off the bat is can I change the macro so that I can drag from a Windows Explorer window and not a browser window? It's not a huge inconvenience, but am curious as to whether that could be done.

Michael Wiktowy

unread,
May 12, 2021, 4:56:30 PM5/12/21
to TiddlyWiki
There must be a way but I'm not sure how to get the path information when you drag and drop a file from a file manager. It doesn't seem to end up in <<actionTiddler>> like a URL/link drag from a browser does.

You also might have to fight with the normal import handler. Being able to import just the URI of the file rather than the file itself with a checkbox would be a useful RFE to the normal import mechanism but extending that is beyond me at the moment.

/Mike

TW Tones

unread,
May 12, 2021, 7:56:47 PM5/12/21
to TiddlyWiki
Running a wiki inside tiddlydesktop will give you more local rights.

I am confident others have solved this problem previously.

Regards
Tones

Reply all
Reply to author
Forward
0 new messages