image-picker subfilter is not working

130 views
Skip to first unread message

David Allen

unread,
Jul 15, 2017, 3:13:48 AM7/15/17
to TiddlyWiki
For some reason, I can't seem to get the subfilter parameter of the image-picker macro to work.

Here's my code:

<$set name=fish filter="[title{!!theImage}get[category]first[]]">
<div>

<<fish>>

<$image class="modal_image" source={{!!theImage}}/>


</div>
<$macrocall $name='image-picker' actions="
<$action-setfield $field=theImage $value=<<imageTitle>>/>
" subfilter="has[category]"/>
</$set>

The thing with the variable fish is something I'll mess with later.

Right now, I should only be seeing three images in the image picker, but I'm seeing all of them.  I'm fairly certain I'm using the image-picker macro as shown in the tiddlywiki site, I'm just not sure what I'm doing wrong.

Mark S.

unread,
Jul 15, 2017, 8:54:10 AM7/15/17
to TiddlyWiki
The problem is we can't see your data. Maybe you could post your TW. Is there any possibility that all your images have a filled category field?

Good luck,
Mark

David Allen

unread,
Jul 15, 2017, 11:03:27 AM7/15/17
to TiddlyWiki
No, they do not all have category fields.  This problem persists even with something as simple as the prefix filter.

I've attached a wiki that is demonstrating the problem.
empty (1).html

Mark S.

unread,
Jul 15, 2017, 11:37:21 AM7/15/17
to TiddlyWiki
It looks like the image picker code was changed, and the subfilter option was dropped without a corresponding change in the documentation. I imagine this was by accident. There's no subfilter, but there's a filter option. For the filter option you'll need to roll your own long filter. For instance, this does what you want to limit the image by prefix:

filter="[all[shadows+tiddlers]is[image]prefix[Image_A]!has[draft.of]] -[type[application/pdf]] +[sort[title]]"


Meanwhile, I've made an issue report

#2939


Have fun,

Mark

Eric Shulman

unread,
Jul 15, 2017, 11:39:06 AM7/15/17
to TiddlyWiki
On Saturday, July 15, 2017 at 2:13:48 AM UTC-5, David Allen wrote:
For some reason, I can't seem to get the subfilter parameter of the image-picker macro to work.

to confirm the syntax and look at the examples... and...

The 'subfilter' example doesn't work there either!  Instead of just showing the 'prefix[Language]' images, it shows all the same images as the unfiltered <<image-picker>>.  So, it might just be a bug in the macro itself, rather than your usage.

-e

David Allen

unread,
Jul 15, 2017, 1:19:21 PM7/15/17
to TiddlyWiki
Thanks!

Also, do you know if there's a way to remove the "Include System Tiddlers" checkbox?

Mark S.

unread,
Jul 15, 2017, 2:50:02 PM7/15/17
to TiddlyWiki
Also made a proposed fix, PR #2940

Mark S.

unread,
Jul 15, 2017, 3:05:52 PM7/15/17
to TiddlyWiki
Haven't tested this, but it should work both to allow you to use the subfilter clause, and to get rid of the checkbox about system tiddlers. Put it in a tiddler and tag it $:/tags/Macro. Then change your macro-call to image-picker2.

Good luck!
Mark

Oh, and is Voyager smaller or larger than the Defiant?

\define image-picker2(actions,filter:"[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[!has[draft.of]$subfilter$sort[title]]",subfilter:"")
<div class="tc-image-chooser">
<$vars state-system=<<qualify "$:/state/image-picker/system">>>
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">
<$macrocall $name="image-picker-list" filter="""$filter$ +[!is[system]]""" actions="""$actions$"""/>
</$reveal>
<$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div">
<$macrocall $name="image-picker-list" filter="""$filter$""" actions="""$actions$"""/
>
</$reveal>
</
$vars>
</div>
\end

Reply all
Reply to author
Forward
0 new messages