HOWTO: Upload files/images to cloud storage automatically

225 views
Skip to first unread message

Carlos R

unread,
Nov 2, 2020, 9:52:41 PM11/2/20
to TiddlyWiki

I am using nodejs version and I want a way to automatically upload files to a cloud storage service such as dropbox. Has anyone attempted this? I like to take screen shots with my notes and it's a bit cumbersome to have to manually link files/images.

Thanks!

TW Tones

unread,
Nov 3, 2020, 6:29:11 PM11/3/20
to TiddlyWiki
Carlos,

I would imagine you can just get Drop box to sync the folder you are using that you want uploaded and it happens in the background. 

Perhaps search the forum and tiddlywiki.com for "dropbox".

Tones

Anjar

unread,
Nov 3, 2020, 6:41:15 PM11/3/20
to TiddlyWiki
Hi,

Haven't tested it, but it may be possible to add an iframe pointing to dropbox, for example in the sidebar? Tag a tiddler with $:/tags/SideBarSegment and add

<iframe src="http://dropbox.com" width="100%" height="300px" style="border:none;">
</iframe>

Seems like dropbox doesn't like it, but maybe one can fix it somehow

Best,
Anders

Donald Coates

unread,
Nov 4, 2020, 5:58:47 AM11/4/20
to TiddlyWiki
With both my nodejs and single file wikis I import images normally and then occasionally run a script that moves them to an external directory and creates a placemarker tiddler with a canonical uri:


#!/bin/bash

myyear=$(date +"%Y")
mymonth=$(date +"%m")

tiddlywiki --save [is[image]!tag[header-img]!moved[yes]] [addprefix[./images/$myyear/$mymonth/]] \ # moves image to directory based on year/month
           --setfield [is[image]!tag[header-img]!moved[yes]] _canonical_uri $:/blog/templates/canonical-uri-external-image text/plain

tiddlywiki --setfield [is[image]!moved[yes]] text $:/blog/templates/empty_text text/plain \
           --setfield [is[image]!moved[yes]] moved $:/blog/templates/moved_field text/plain

Setting a field to 'moved' is crucial because otherwise tiddlywiki will perform this operation on an emptied image and overwrite the original.

So locally you could move the files to a synced folder or on a server it might be a bit more complicated.

Carlos R

unread,
Nov 4, 2020, 8:32:13 PM11/4/20
to TiddlyWiki
This is extremely helpful I will give a shot using dropbox.

Carlos R

unread,
Nov 4, 2020, 11:20:57 PM11/4/20
to TiddlyWiki
Sorry still new to tiddly, I ran into trouble running the script. Could you share what these are?
  • $:/blog/templates/empty_text
  • $:/blog/templates/moved_field
  • $:/blog/templates/canonical-uri-external-image

Donald Coates

unread,
Nov 6, 2020, 8:09:53 PM11/6/20
to TiddlyWiki
Absolutely.  With the setfield command we are setting the value for the field _canonical_uri, text, and moved.  _canonical_uri is a default field that tiddlywiki looks for that marks the tiddler as a placeholder pointing to a specific address.  text is a default field containing the text of the tiddler. moved is a user created field we use to mark the tiddler as having been run through the script already so that tiddlywiki doesn't overwrite the moved image with the empty file we create with the script.  Ie if we didn't mark the image tiddlywiki would move the empty placeholder and overwrite the actual image on a second pass.

the setfield command looks for the field to set and then requires a tiddler with the value of the field as it's text.  so

the tiddler ..../empty_text is just an empty tiddler.  Therefore the text of the placeholder tiddler is set to empty.  You may have to use a space I can't remember.

the tiddler ..../moved_field has the text 'yes'.  therefore a field called move is created on that tiddler and it's value is set to yes.  now on subsequent passes of the script tiddly wiki will ignore this tiddler and only act on those images ( is[image] ) that do not have the value of yes ( !moved[yes] )

the tiddler ..../canonical-uri-external-image has the value of the _canonical_uri and generally requires some sort of transclusion of the tiddler title so that it is unique.  In my case is:
./images/<$view field="created" format="date" template="YYYY"/>/<$view field="created" format="date" template="0MM"/>/<$view field="title"/>

This points to the directory that I saved to in the first line by adding the images/month/year to the filename of the actual image so that tiddlywiki moves it to that directory.

Hopefully that makes sense please feel free to ask. 

Carlos Rojas

unread,
Nov 10, 2020, 3:43:20 PM11/10/20
to tiddl...@googlegroups.com
Awesome! Works perfectly. I might modify it to also handle PDFs.  

On Nov 6, 2020, at 17:10, Donald Coates <digit...@gmail.com> wrote:


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/rrG82Dc8Eyw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8aff9f68-3cde-493d-aa74-83ebc035108ao%40googlegroups.com.

Donald Coates

unread,
Nov 10, 2020, 8:15:34 PM11/10/20
to TiddlyWiki
Let me know if you have trouble with that - nor sure if you can 'save [is[pdf]]'.  I have an old bash script laying around somewhere for doing just that outside of using tiddlywiki --save
To unsubscribe from this group and all its topics, send an email to tiddl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages