Think I am starting to get this import and transclusion thing down, but

Straight up deserves a tiddly star! Okay, this maybe ranges few disparate ideas. Not sure.

A. Have imported image, say: image.png, into it’s own tiddler called: image.png.

B. Transcluded that image into another tiddler with ex: <$link to="My Fab Tiddler Example" tooltip="Don't be playa hatin' cuz I be doing this!">{{image.png}}</$link>.

Things going good after finishing Prometheon stint. Have a cuppa.

Now, what I would like to do is attach the link attributes of B to A. Am thinking this has something to do with adding and manipulating different field names and values within A. Correct? If so, how with concrete examples?

Or, does it take something like one of those crazy mental tiddler moves $:/tags/bowels/of/TiddlyWiki and I am making another tiddler C:

transcluding A into C, then transcluding C into B, if so with examples please, or:

just originating image.png into C with field name and value attributes and just transcluding into B, if so with examples pretty please?

Ultimate goal is to randomly import and display one (1) image with said attributes, from pool of similarily attributed images, into tiddlers via template.

Thumbs up!

I think we need more elaboration on what you want to accomplish.

I think you’re saying that when you pull up some tiddler “C”, you want to see some randomly selected tiddler “A”. Is that correct? Or are your trying to display a set of images randomly?

The random part would be tricky. It will require either a 3rd party random tool, or a pseudo-random process based on, for instance, time.

Basically, what I am trying to accomplish is I have tiddlers that are an image and attributes. Using something like tobi_beer random I tag them and randomly place them on tiddlers.

That is why I was asking above about using fields and names with import tiddlers, then just taging them or transcluding those into a sytem macro.

You can add fields to image tiddlers. So you could add say a parent field that would connect your image to the tiddler where it used. Like

parent: "My Fab Tiddler Example"

Then you could use a template tiddler, and whenever you viewed “My Fab Tiddler Example”, it would show you all the images whose parent field contained “My Fab Tiddler Example”.

Is that something like what you want?

Okay,

Thanks @Mark_S, but not what looking for.

Can I have an import image tiddler that has attributes such as href, title, etc. attached to that tiddler?

i.e. <$link to=SomePlace>[img[SomeTextHere|https://SomeImage.png]]</$link>, but using names and fields of import tiddler?

Do these import image tiddlers not render as said image when transcluded?

To best of my knowledge any tiddler can be tagged, no?

Could these tagged import image tiddlers not then be randomized using something as simple as tobi_beer random?

Rewrite this as follows;

<$link to=Image-tiddler>SomeTextHere</$link>

and in Image-tiddler store the image or use ExternalImages

Of course you could tag all image tiddlers and use a list widget etc…

@TW_Tones thank you for reply.

I do not think looking for a list function, hence “(maybe)” below, unless it somehow accomplishes grabbing random entry from tagged or list of import image tiddlers and displaying with said attributes.

Think needing to go like this, (but of course could be wrong:

Placed in any tiddler: {{Random Tag or List?-Image-Tiddler}}

Using image import tiddler, with href and title attributes, somehow attached in someway (I am using <$link> as representation of what trying to accomplish with image import tiddler):

<$link to="https://example.com">[img[SomeTextHere|SomeImage.png]]</$link>
1 Like

@maqueen I suppose what I am implying here is the $list widget and filters can be used to show/list 0, 1 or many tiddler titles, and can then display what you want given the title(s) found.

  • Thus if you write your code to act on the current title, often also the value of <<currentTiddler>> then you can use whatever filter you want, including one that generates a random title.
  • Once you have a “current tiddler” set you can access it’s tags, fields, display “its” images etc…

Okay @TW_Tones, I guess what my next question is then: can specific attributes above i.e. href and title, be added to image import tiddlers using field and name lines?

Could you explain that a little further?

  • If you import an image and it becomes a tiddler, except for editing the text field, which contains the image, you can tag and set fields all you want.
  • If your tiddler has the information you need you can write a macro to construct a link however you wish.
  • The are ways to drop or import links to tiddlywiki but it depends on how and what you import.

I admit to being stumped at first about how to interpret.

And I’m not one of the advanced folks! But I do care about supporting folks who have a vision, and I think once I understand what you’re trying to do, it’s the kind of thing I would be able to cobble together.

I’m imagining that you want to have a set of links available on your page, where each link looks like an image, and each of those images points to a specific tiddler or external url link (and has its own witty tooltip). Or maybe you want that, plus some randomness magic thrown in, which can be done. :wink:

One thing that’s difficult, at least at my level of usage, is to accomplish much with image tiddlers themselves. It’s true that you can import images to make tiddlers out of them, and you can add fields to those image tiddlers. But here are the two challenges:

(1) If images are large (or if there are many of them) they start to weigh down a TiddlyWiki, performance-wise. So I keep actual imports to a minimum. Maybe that’s fine for your project because these images are relatively small, and not a huge number of them…

(2) The imported image tiddler’s content is the image itself. That means it’s a bit harder to use it to do business. I’m sure there are workarounds, but I generally end up having non-image tiddlers do the real work, and point to the image tiddlers (or image links on a file or server somewhere) just to add the pretty face to the action.

If I understand right, the following “B” tiddler is a good model of the effect you’re aiming for:

<$link to="My Fab Tiddler Example" tooltip="Don't be playa hatin' cuz I be doing this!">{{image.png}}</$link>

When you say you want to “attach the link attributes of B to A” (where A is image.png), it sounds like you want A to behave always as a link in this way. But A is stuck being a plain-old image tiddler. Yes?

But if you add fields to tiddler A (the image.png tiddler) you can still set up a link that looks like this:

<$link to={{image.png!!link-to}} tooltip={{image.png!!tooltip}}>{{image.png}}</$link>

In other words, you’re having the link widget “find” the destination and tooltip within the image tiddler’s fields…

If you like this, then you can add these fields as needed to your imported images, and use the <$link> widget in this way.

Last step — the one I know I can do, but which others here can do in their sleep — is to make a custom fab-link macro so that you can type something convenient like

<<fab-link src:"image.png">>

… to get this kind of result for any of your doctored-up imported images – each one “knowing” where to point based on fields in the image tiddler itself.

But let me pause and see whether I’m remotely understanding what you’re trying to set up. :face_with_monocle:

2 Likes

@Springer you rock!

EXACTLY! And actually, just a link but I digress. Concerning your 1 and 2 above we are not talking wallpapers more like 100x300px small banner size as example

Absolutely.

My main issue after getting the theoretical issues out of the way, and this is a simple one (I think), how do you do these name/field modifications to an (import) tiddler?

Next, how could a number of above tiddlers be randomized and served(?) to:

Lastly, what would be format for the monster transcluded $link that would use all of the above?

Did you have something next here that might have registered as code? If you can edit to enclose in triple-brackets, that should help everything show up here…

I don’t yet follow what kind of monster link you have in mind… one that lists all, or a randomized set, of the image-style links we’re talking about?

Anyway, here’s a demo of having the link pull on the fields in your image tiddler:

https://quick-demo.tiddlyhost.com/#polygon.png:polygon.png%20[[getting%20link-to%20from%20image%20tiddler]]

I don’t have time at the moment to build and troubleshoot a macro that would do all this more compactly, but the crucial step is making sure each link looks and behaves as you need it do.

To edit the fields of any given image tiddler, you can just open the tiddler in edit mode and use the “add field” area at bottom.

1 Like

@Springer 's code creates a “link image” based on a ‘‘literal’’ tiddler name: image.png:

This code does the same with the “current tiddler” (more on that later):
<$link to={{!!link-to}} tooltip={{!!tooltip}}>{{}}</$link>

Then how do I make “current tiddler” to be “image.png”? There are several ways, but let’s consider the <$list> widget:

<$list filter="[[image.png]]">
<$link to={{!!link-to}} tooltip={{!!tooltip}}>{{}}</$link>
</$list>

What we did here is feed the <$list> with a very simple filter returning a list of 1 tiddler: image.png.

If every image tiddler is tagged “myImages”, then next code creates a “link image” with every image tagged “myImages”:

<$list filter="[tag[myImages]]">
<$link to={{!!link-to}} tooltip={{!!tooltip}}>{{}}</$link>
</$list>

What we need now is a smarter filter that can select a random image in this list… but as far as I can tell TW can’t do that without an additional plugin…

Maybe others (or a search for “random filter” here on talk.tiddlywiki.org :wink:) can help dig further…

Fred

1 Like

@maqueen I am sure @Springer and @tw-FRed have provided some useful information to you. However I feel you have something in mind we have not yet understood. If you can spell out what you mean by “monster link” etc… with a little more details. but in case it helps I will describe this are a little more generally.

We may use tiddlers to store data or images, be they images, pdf and either internal (in the wiki) or external. Consider these data or resources to make use of in your wiki.

  • Once you have these resources you can open their tiddler to see its content.

Now in other tiddlers we may want to organise all our resources, list and display them and do things such as create links to either the resource, to open the resource tiddlers, or perhaps to follow another external link when you click on an image.

  • We often want to do the same thing more than once so we often use a little TiddlyWiki script to add extra information in our wiki,
  • It makes sense to add information that relates to a give resource, and save it with that resource, in its tiddler. eg in its fields or using a tag.
  • Once we have a general way to display a resource and say make it clickable to navigate to a web address we can then use a filter to do this for one or more tiddlers/resources, and in you case a random filter, show one random resource at a time that can be clicked. You can see here why it may be useful to have a separate tiddler that shows different images at different times.
  • This is typically when we transude our image/resource tiddler and wrap it with additional functionality.

However;

If you have a lot of searchable images and you are more likely to open the resource or image tiddler itself, you could make a template for viewing your resource tiddlers. We can use the view template system or even a “view body cascade” to generate a link when viewing the image tiddler itself. We could use both this method and the one above at the same time.

I created my own (for want of a better word) Monster links in the past, which provide a tooltip extracted from a field in the resource tiddler, generate a target tab name so links always open in the same tab, or extract the resource title from the caption field.

Indeed, the simplest way to get a bundle of this stuff together is to take the list structure @tw-FRed proposed, and tweak it to be an actual list, like so:

<$list filter="[suffix[.png]has[link-to]]">
<$link to={{!!link-to}} tooltip={{!!tooltip}}>{{}}</$link>
</$list>

This will look for every tiddler whose title ends in .png and which has some value in its link-to field. Then for each of those it will show the image which should function as a link, showing the right tooltip (as specified in each respective image-tiddler’s field).