hm, I think I see a bug in teh SemanticResults format, which may be contributing; perhaps this has less to do with the image than I thought:
in SRF_Exhibit.php, there's this section:
if (preg_match_all("/[{][{][{][1-9A-z\-[:space:]]*[}][}][}]/u",$lenswikitext,$matches)) {
foreach($matches as $match){
foreach($match as $value){
$strippedvalue = trim($value,"{}");
$lenswikitext = str_replace($value,'<div class="inlines" id="lenscontent'.$lenscounter.'">'.$this->encodePropertyName(strtolower(str_replace("\n","",$strippedvalue))).'</div>',$lenswikitext);
$lenscounter++;
}
}
In my lens code, I had two appearances of {{{label}}}
the preg match finds both, and iterates over both in teh next foreach.
except, the str_replace, on the FIRST pass, replaces BOTH appearances of {{{label}}} with the div html stuff.
and gives BOTH divs the same id. So two elements with the same id is a problem off the bat,
and on the second pass, there's no replacing, but the lenscounter gets incremented.
so I've got a lenscounter that's out of sync with the ids I have.
but where it gets problematic, is in the SRF_Exhibit.js code,there's this business:
for(var i = 0; i < lenscounter; i++){ //lenses
var test = document.getElementById("lenscontent"+i);
test.setAttribute('ex:content','.' + test.innerHTML);
test.setAttribute('class',"inlines");
test.innerHTML = '';
}
the test var is null, for the second appearance of the label div. So the code breaks with a fatal error there.
That's why sometimes the map wouldn't show up at all.
I "fixed" that by changing the above javascript to skip on a null 'test' var. But that doesn't seem like the best fix to me.
In the meantime, I took out the extra {{{label}}} var, to get around the problem.
still not getting my image to appear.
I've tried:
[[image:{{{http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg}}}]]
[[image:http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg]]
http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg
in my lenses, and in all cases, the lens just shows the url (though with the correct replacement of the {{{label}}} var with the page label), not the image.
on a regular page, using
http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc=43.85.16&imgSize=3&ext=.jpg
does cause the image to show up.
________________________________
From: zehetner <zehetner@...>
To: don undeen <donundeen@...>
Sent: Mon, May 3, 2010 11:31:46 AM
Subject: Re: [Semediawiki-user] images in Exhibit lenses
Hmmm the syntax I suggested was just a guess from looking at the code.
Unfortunately I don't have a working example of an image server like your
http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx to try it
out.
It would be the easiest to just write out some debug info on the various
code parts where it deals with the template content (in php and js) but for
that one needs a test case.
I'm also confused where you get the 'var lens' from. SRF_Exhibit.php (if
I'm right to assume you are using the Exhibit SRF printer) write only 'var
ex_lens' into the js part of the page :((
Also why you have 'lenscounter =4;linkcounter=0;' but no 'imagecounter='
following the linkcounter var is rather confusing.
Maybe you can copy/paste to header part of the page source (or give me the
url of a test page) than I can see more clearer what's going on.
Gu
On Mon, 3 May 2010 08:10:16 -0700 (PDT), don undeen <donundeen@...>
wrote:
> ok,I setthis up as you described, and here's what I've got:
>
> So My template looks like:
> {{{label}}}<br>
> Consists of: {{{Consists of}}}<br>
> Made By: {{{Made by}}}<br>
>
>
[[image:{{{http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg}}}]]
>
> when i load the page, I don't even see the map; where the map should be,
I
> see:
>
>
>
> Consists of:
> Made By:
>
[[Image:{{{http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc=
> label&imgSize=3&ext=.jpg}}}]]
>
> so it looks like a blank template.
>
> - there's no ex_lens variable in the source, but there is a lens
> variable. the source looks like:
>
> var lens = '
> label
> Consists of:
> consists_of
> Made By:
> made_by
>
[[Image:{{{http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc=
> label&imgSize=3&ext=.jpg}}}]]';lenscounter =4;linkcounter=0;
>
> judging from what it did to my template variable with the image link, it
> looks like it's breaking there:
>
> [[Image:{{{
> - there's no imagecounter var, but there is a lenscounter = 4
>
>
> any ideas?
> If I take out the {{{label}} inside the image link, I do see the map,
but
> when an infowindow loads, it looks like:
>
>
> 21.76
> Consists of:Glazed stoneware
> Made By:Édouard Manet, Théodore Duret, A. Strölin, and W. B. Paterson
>
[[image:{{{http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc=statictext&imgSize=3&ext=.jpg}}}]]
>
>
> any ideas?
>
> btw, version info:
> MW 1.15
> php 5.3
> mysql 5.1.36
> SMW: 1.4.3
> SMWHalo: 1.4.6
> Semantic Resul Formats: 1.4.5
>
> Thanks all!
>
>
>
>
> ________________________________
> From: Günther Zehetner <zehetner@...>
> To: smw list <semediawiki-user@...>; don undeen
> <donundeen@...>
> Sent: Sat, May 1, 2010 1:13:31 PM
> Subject: Re: [Semediawiki-user] images in Exhibit lenses
>
> Basically I think you need in the lens template instead of
> Label: {{{label}}} <br />
>
http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg
>
> something like
> Label: {{{label}}} <br />
>
[[image:{{{http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg}}}]]
>
> because it seems images are only recogniced if they satisfy
>
if(preg_match_all("/[\[][\[][Ii][m][a][g][e][:][{][{][{][1-9A-z\-[:space:]]*[}][}][}][\]][\]]/u",$lenswikitext,$matches))
> and only in this case the 'imagecounter' is increased.
>
> Not sure if it really works that way but it's worth a try.
> On the 'var ex_lens =' line there is also 'ex_imagecounter=' which needs
> to be not 0 for the JS to create an 'img' element with the
'ex:src-content'
> tag.
> Gu
>
> --- On Sat, 5/1/10, don undeen <donundeen@...> wrote:
>
>> From: don undeen <donundeen@...>
>> Subject: Re: [Semediawiki-user] images in Exhibit lenses
>> To: zehetner@..., "smw list"
>> <semediawiki-user@...>
>> Date: Saturday, May 1, 2010, 6:06 PM
>> yes to both, sadly :( .
>>
>> I've got wgAllowExternalImages set, and the images work in
>> a regular page.
>> I tried allowing raw html, and including image tags, as
>> well.
>> I think the lens template parser is skipping a step. I've
>> noticed that in some other functions as well.
>>
>>
>>
>>
>>
>> ________________________________
>> From: Günther Zehetner <zehetner@...>
>> To: smw list <semediawiki-user@...>;
>> don undeen <donundeen@...>
>> Sent: Sat, May 1, 2010 10:36:21 AM
>> Subject: Re: [Semediawiki-user] images in Exhibit lenses
>>
>> Hi,
>> does a image show up in a normal wiki page if you insert an
>> url like this?
>> Have you set $wgAllowExternalImages to true?
>> I have not tried lens templates and I might be wrong but it
>> looks like you include an external image and for that the
>> above variable has to be set otherwise only the link
>> shows up.
>> http://www.mediawiki.org/wiki/Manual:$wgAllowExternalImages
>> Cheers
>> Gu
>>
>> --- On Sat, 5/1/10, don undeen <donundeen@...>
>> wrote:
>>
>> > From: don undeen <donundeen@...>
>> > Subject: [Semediawiki-user] images in Exhibit lenses
>> > To: "smw list" <semediawiki-user@...>
>> > Date: Saturday, May 1, 2010, 12:24 AM
>> > Hi, I'm still working on my Semantic
>> > Results Format with Exhibit here,
>> > and I'm trying to get an image to show up in the lens
>> >
>> > I've got a lens template that looks like:
>> >
>> > Consists of: {{{Consists of}}}<BR />
>> > Made By: {{{Made by}}}<BR />
>> > Label: {{{label}}} <br />
>> >
http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{{label}}}&imgSize=3&ext=.jpg
>> >
>> > that last bit is a uri for a service that provides an
>> > image, ie, entering that url in a webbrowser
>> (with a
>> > valid value for {{{label}}} ) will display an image.
>> >
>> >
>> > but when I load my map page, though the label text
>> gets
>> > included, I just see the image url.
>> >
>> > I also tried:
>> >
http://ssemtestdb00:8765/services/MediaBinImageURI/Default.aspx?objAcc={{#urlencode:{{{label}}}}}&imgSize=3&ext=.jpg
>> >
>> >
>> > But that didn't work either.
>> >
>> > Does someone know the "correct" way to do this?
>> >
>> > thanks!
>> > Don Undeen
>> >
>>
------------------------------------------------------------------------------
>> > _______________________________________________
>> > Semediawiki-user mailing list
>> > Semediawiki-user@...
>> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>> >
>>
------------------------------------------------------------------------------
>> _______________________________________________
>> Semediawiki-user mailing list
>> Semediawiki-user@...
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>
|