Eric Shulman ha scritto:

To achieve a "local vs. remote" effect, simply define the local and
remote paths in ImagePathList, e.g.,
   file:///c/path/to/imgs/
   http://www.mywebsite.com/imgs/

Thanks but, mmmh, I tried your plugin without success:

this are the paths in my ImagePathList fragment (the order is relevat, first the local path, second the remote path):
./immagini/
http://digilander.libero.it/tizzziano/images/


and here is the link of a test image:

[img[This is my test image|icona_80x80.jpg]]

While the local TW works fine, and the resulting html is:
<img title="This is my test image" src="./immagini/icona_80x80.jpg"/>

the online TW does not display the image and the html looks like:
 <img title="This is my test image" src="icona_80x80.jpg"/>

Maybe I missed something?

Please note that I think there is a missing line in yout plugin:
        if(lookaheadMatch[3]) {
                img.title = lookaheadMatch[3];
                img.setAttribute("alt",lookaheadMatch[3]); <-- missing

In fact in the html there is no "alt" attribute for the image.



Anyway, I'm realizing that images can be embedded also in HTML fragments, so the need to make it in another (simpler) way, using jQuery:

this is the new macro:

// remote path to images
if (config.options.txtRemoteImgPath==undefined)
config.options.txtRemoteImgPath="http://digilander.libero.it/tizzziano/images/";;
if (config.options.txtLocalImgPath==undefined)
config.options.txtLocalImgPath="./immagini/";

config.macros.postTiddler = {};
config.macros.postTiddler.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
       var imgs=jQuery('img');
       var imgpath;
       if (window.location.protocol != "file:")
          imgpath=config.options.txtRemoteImgPath;  //  remote url
        else
          imgpath=config.options.txtLocalImgPath;

       imgs.each( function() {
          jQuery(this).attr('src', imgpath+jQuery(this).attr('src'));
        });
};


and put it in my viewTemplate

.....
<div  macro='postTiddler'></div>
<div class='tagClear'></div>


maybe there is some other better (simpler) way?
--
tiziano de togni
______________________________________
http://digilander.libero.it/tizzziano/
http://tiziano.tiddlyspot.com


--
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to