I wish that there was a more intelligent [import] button that could link to external images without the needfor manually inserting the _canonical_uri field.
\define embedded-image-actions()<$wikify name="tiddlercontent2" mode="inline" text='<<actionTiddler>>'><$action-createtiddler $basetitle="New Image" _canonical_uri=<<tiddlercontent2>> type="image/jpeg" $savetitle="Embed JPEG!!tiddlertitle"/><$action-navigate $to={{Embed JPEG!!tiddlertitle}}/></$wikify>\end
<$droppable actions=<<embedded-image-actions>>><div style="height:2em;"><div style="border:1px dotted; width:15em;padding:0.7em;border-radius:5px;text-align:center;">Drop JPEG Image Here</div></div></$droppable>With the following code, a JPEG image from a web location can be dragged into an area marked "Drop JPEG Image Here", and a tiddler containing the _canonical_uri of the image is automatically created:\define embedded-image-actions()<$wikify name="tiddlercontent2" mode="inline" text='<<actionTiddler>>'><$action-createtiddler $basetitle="New Image" _canonical_uri=<<tiddlercontent2>> type="image/jpeg" $savetitle="Embed JPEG!!tiddlertitle"/><$action-navigate $to={{Embed JPEG!!tiddlertitle}}/></$wikify>\end<$droppable actions=<<embedded-image-actions>>><div style="height:2em;"><div style="border:1px dotted; width:15em;padding:0.7em;border-radius:5px;text-align:center;">Drop JPEG Image Here</div></div></$droppable>
\define embedded-image-actions()<$wikify name="tiddlercontent2" mode="inline" text='<<actionTiddler>>'>
<$vars imageType={{{ [<tiddlercontent2>>suffix[.jpg]addprefix[image/jpeg]removesuffix<tiddlercontent2>] [<tiddlercontent2>>suffix[.jpeg]addprefix[image/jpeg]removesuffix<tiddlercontent2>][<tiddlercontent2>>suffix[.png]addprefix[image/png]removesuffix<tiddlercontent2>] }}}><$action-createtiddler $basetitle="New Image" _canonical_uri=<<tiddlercontent2>> type=<<imageType>> $savetitle="Embed JPEG!!tiddlertitle"/><$action-navigate $to={{Embed JPEG!!tiddlertitle}}/>
</$vars>\define embedded-image-actions()
<$set name="tiddlercontent2" mode="inline" filter="[<actionTiddler>removeprefix[file:///C:/Users/Mark/Downloads/]]">
<$action-createtiddler $basetitle="New Image" _canonical_uri=<<tiddlercontent2>> type="image/jpeg" $savetitle="Embed JPEG!!tiddlertitle"/>
<$action-navigate $to={{Embed JPEG!!tiddlertitle}}/>
</$set>
\endSo... I've been embedding external images with
[img[http://url.svg]]
But I could do this with canons and uri?
What are the advantages as, having had a look at the documentation, I'm still not massively clear...
What are the advantages as, having had a look at the documentation, I'm still not massively clear...
I believe this could make it work for more types:
Trying to load external content from [URL]
If this message doesn't disappear, either the tiddler content type doesn't match the type of the external content, or you may be using a browser that doesn't support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText
Downside: I believe that a separate tiddler/drop area needs to be created for other image types, e.g. PNG.
\define embedded-image-actions()
<$wikify name="tiddlercontent2" mode="inline" text='<<actionTiddler>>'>
<$action-createtiddler $basetitle="New Image" _canonical_uri=<<tiddlercontent2>> type={{Embed Image}} $savetitle="Embed Image!!tiddlertitle"/>
<$action-navigate $to={{Embed Image!!tiddlertitle}}/>
</$wikify>
\end
<$droppable actions=<<embedded-image-actions>>>
<div style="float:left;margin-right:1em;">
<div style="border:1px dotted; width:15em;padding:0.8em;border-radius:5px;text-align:center;">Drop image (<$list filter="[[Embed Image]get[text]]+[removeprefix[image/]]">{{!!title}}</$list>) here</div></div>
</$droppable>
<div style="height:2.5em;">
Image type: <br/>
<$select tiddler='Embed Image'>
<option value='image/gif'>GIF</option>
<option value='image/jpeg'>JPEG</option>
<option value='image/png'>PNG</option>
<option value='image/svg+xml'>SVG</option>
</$select></div>