I have used xlst pagination on mywebsite, I have a document type called "article" and one of the property of the article entity is a image [media picker], I call it "'nationalicon'", which basiclly display a national flat image.
I want to display this attribute on my web page, instead of seeing the image, I saw a number displayed at the place of the image.
Thank you so much for your help. I hard coded the media id into it and it works,but then I had this trouble of using passing the media id into a local variable and use it in the image code:
Happens when a var doesn't get a 'real' value when saving the xslt (in your case: 'iconId'), resulting in a GetMedia call with NaN value as the first param)
2 options here:
- tick 'ignore errors' and save xslt.
- surround the complete snippet with an extra if statement
"If"-check solved the problem. I think, it because on design time (in developer mode) $currentPage/data[@alias='photo'] have no value, so we got Overflow exception.
How to display image in xlst
Hi guys girls
I have used xlst pagination on mywebsite, I have a document type called "article" and one of the property of the article entity is a image [media picker], I call it "'nationalicon'", which basiclly display a national flat image.
I want to display this attribute on my web page, instead of seeing the image, I saw a number displayed at the place of the image.
http://www.airforcewing.com/wings.aspx?page=1
Any ideas.. here is my xlst code.
Thanks alot.
[code]
[/code]Hi Jefferycxl
You have to ude the library function GetMedia in order for you to access and show media - what you have now is the media id.
[code]
...
...
[/code]
See http://blackpoint.dk/umbraco-workbench.aspx?Snippet=/umbraco-workbench/xslt/accessing-media-files.aspx for more info.
Hi Tommt
Thank you so much for your help. I hard coded the media id into it and it works,but then I had this trouble of using passing the media id into a local variable and use it in the image code:
Hi,
Remove the () chars from the select as in:
[code]
[/code]
Hope this helps.
Regards,
/Dirk
Hi Dirk
Thanks for your reply. I am still unable to pass the document attribute value into a variable:
I got error:
Error occured
System.OverflowException: Value was either too large or too small for an Int32.
I think there there is a syntax error in my code:
Thanks & Regards,
Jeffery
Hi jefferycxl,
Happens when a var doesn't get a 'real' value when saving the xslt (in your case: 'iconId'), resulting in a GetMedia call with NaN value as the first param)
2 options here:
- tick 'ignore errors' and save xslt.
- surround the complete snippet with an extra if statement
[code]
[/code]
Latter option is best practice!
Cheers,
/Dirk
Fantastic !
You not only solve my problem also teach me why.
Thanks & Regards,
Jeffery
Hi all, here is solution:
[code]
[/code]
"If"-check solved the problem. I think, it because on design time (in developer mode) $currentPage/data[@alias='photo'] have no value, so we got Overflow exception.
Thank you Alek.sys.. that helped me
is working on a reply...