The ImgWizard plugin challenge!

108 views
Skip to first unread message

Mat

unread,
Apr 12, 2015, 3:29:52 PM4/12/15
to tiddl...@googlegroups.com

I fear most public TWs - (and probably even yours!) - look like webpages from 1995.

You and I know a TW is not "just a webpage" but visitors see it as, well, a page on the web - and they expect pages on the web to have nice graphics etc. And informative graphics too, for that matter. This area is typically lacking badly in TWs. (Yours too?)


Now, imagine if adding images was easy. I mean really SUPER EASY.

So here's a plugin concept for ya: An image wizard!

I believe that whoever implements it will have a sure fire success for a long time to come.


This is how it could appear in use:

In tiddler edit you simply type in e.g <<img>>. No urls. No intricate commands. Not even any size specs!

Switching over to tiddler view mode, a popup opens showing your favourite image search engine, e.g Google Image search.




There you do the usual Google procedure: enter search words, select desired image click the "View image" button to display the sole image at it's specific url.



...but once that View image is seen, you popup also shows Width [__]px, Height [__] px and a button [OK] (which actually means "Use this url and the stated dimensions". ...and there are some default values presented for the dimensions set by you at some earlier time - but you can change them here if you want to.

Clicking the button makes a Ka-Zam sound and when the smoke settles there is an image embedded in your tiddler where the invocation was made!

<;-)


Oh - "How?" ...Darn, I knew there was a catch. Ok, non-coder hypothersizin' here:

First, the invocation for the macro or script or whatever it is might not be exactly <<img>> but it should be super easy. Maybe [[img]] or some other very easy-to-remember thing. No parameters paramter values stated in the invocation for it, that is key.

Clicking the OK button pulls the url for the displayed image. I believe this is possible using techniques described here

This url is inserted into/as a field in the current tiddler (i.e the tiddler using the img command). Say field "imgurl". This is, by the macro, applied to e.g a _canonical_uri template so to get a clean embedding. The dimensions also creates fields imgwidth and imgheight.

Adding another occurrence of the same command creates imgurl#2 or some such.


Any wizards among us wiling to pick up the challenge? I honestly believe something like this could become a very popular plugin in TW.


<:-)

What might appears to be an elegant wizards hat on me is merely a simple conehead...

Jed Carty

unread,
Apr 12, 2015, 4:50:51 PM4/12/15
to tiddl...@googlegroups.com
The two parts of that that I am unsure of are including the image search and just having a single <<img>> macro. Both should be doable, but they would be the hard part. The image search I have no idea how to do, the part where you just put <<img>> would require either some very interesting magic to uniquely identify which instance of <<img>> in a tiddler is being pointed to (in case there were multiple images in the same tiddler), or it would require the popup to edit the text of the tiddler to something that can uniquely identify that image.

I have the start of something not completely unlike what you are talking about here, but it is missing the two things I mentioned above, which are probably the most important parts.

It would be possible using two steps, one where you use a simple interface to find images and add the information for them to the wiki (you may be able to just use tiddlyclip with some custom rules for this part), and one where you have a simple way to put one of the images already added to your wiki into a tiddler. Compared to what you are talking about this seems rather limited though.

Mat

unread,
Apr 12, 2015, 6:00:43 PM4/12/15
to tiddl...@googlegroups.com
On Sunday, April 12, 2015 at 10:50:51 PM UTC+2, Jed Carty wrote:
The two parts of that that I am unsure of are including the image search and just having a single <<img>> macro. Both should be doable, but they would be the hard part. The image search I have no idea how to do,

Hm, the way I imagine is simply(?) just to have an iframed google image search page. Pretty much this exact page. What you enter the search words into is the actual google image search field, just like showin in the first image. And when clicking an image there, google opens a "black area" showing the image that contains the "View image" button mentioned. Really nothing we woudl have to do at all (or?).

 
the part where you just put <<img>> would require either some very interesting magic to uniquely identify which instance of <<img>> in a tiddler is being pointed to (in case there were multiple images in the same tiddler), or it would require the popup to edit the text of the tiddler to something that can uniquely identify that image.

Yes, I considered both scenarios (but I'm no hacker). There is a natural sequence though in that a tiddlers content is processed from top down (...right?) so maybe in hitting the first invocation ("#1"), it would associate it with imgurl#1, etc.

Or, as you say, the call could be edited. Actually, it could be so tricky that the width,height and url fields are maybe transcluded directly into the call! (I'm tired so this may be pure fantasy of mine), but I mean, maybe something like [[img]] could, on Done, be transformed into

[img width={{!!imgwidth}} height={{!!imgheight}} [{{!!imgurl}}]]

...and what is seen in that second image I posted are really the directly editable fields there!

(So simple!!! My nonchalant ignorance almost convinces myself here!)

 
I have the start of something not completely unlike what you are talking about here, but it is missing the two things I mentioned above, which are probably the most important parts.

I must look closer at this tomorrow. I noted a zebra and then somehow I stumbled over the worlds cutest chamelion but I don't understand how it showed up. Tomorrow.

<:-)

Eric Shulman

unread,
Apr 13, 2015, 2:11:32 AM4/13/15
to tiddl...@googlegroups.com
On Sunday, April 12, 2015 at 3:00:43 PM UTC-7, Mat wrote:
On Sunday, April 12, 2015 at 10:50:51 PM UTC+2, Jed Carty wrote:
The two parts of that that I am unsure of are including the image search and just having a single <<img>> macro. Both should be doable, but they would be the hard part. The image search I have no idea how to do,

Hm, the way I imagine is simply(?) just to have an iframed google image search page. Pretty much this exact page. What you enter the search words into is the actual google image search field, just like showin in the first image. And when clicking an image there, google opens a "black area" showing the image that contains the "View image" button mentioned. Really nothing we woudl have to do at all (or?).

One problem with iframing the google image search is that you would still need to get the selected URL from the iframe.  I think the better approach would be to develop an actual widget that uses the official Google API for image searches:


This would not be trivial, but would give us complete control over the interaction and presentation of the search, as well as programmatic access to the URLs of the search results, which could then be used with some kind of widget (e.g. <$google>...</$google>), that would cycle through the search results and use the widget content to generate output (or perform other actions, like setting tiddler fields) using 'search results' variables set by the widget (e.g., $url$, $imgurl$, $width$, $height$, etc.).

-e

PMario

unread,
Apr 13, 2015, 9:16:49 AM4/13/15
to tiddl...@googlegroups.com
I know, that nobody cares, but embedding and redistributing images form someone else may be a copyright problem, if the right license is missing!
Just because in the web everything can be done, doesn't mean that it can't cause trouble.

Just some thoughts:

 - Even Google takes copyright seriously [1] and the dev API, that Eric mentioned can be used to create appropriate search results [2]. .. at the bottom of the page.

 - It's relatively easy to create a "take down" request [3]. All providers have a similar form. I just used the first one I could remember.

 - If you serve an image from my server with a link from your server, you use traffinc, I have to pay for. Some owners may not like this.
 - If you serve an image from my server with a link, I can change the content at any time. .. This content may not be appropriate for you users!

have fun!
mario

[1] https://support.google.com/legal/topic/4558877?hl=en
[2] https://developers.google.com/image-search/v1/devguide  near the end search for "copyright"
[3] https://www.digitalocean.com/company/contact/#tab_abusetrigger
Reply all
Reply to author
Forward
0 new messages