$doc.getAttachmentURL is used for files attached to $doc, i.e. the current
document, so you either use

$doc.getAttachmentURL('fileName')

or

$xwiki.getAttachmentURL('Space.Page', 'fileName')

Hope this helps,
Marius

On Feb 28, 2014 6:07 PM, "Gerritjan Koekkoek" <gerritjankoekk...@gmail.com>
wrote:
>
> Hi,
>
> Would like to set a backgroundImage dynamically
> (I have attached 25 jpg files to a page)
>
> If I add this velocity code into my wiki page it works!
> {{velocity}}
>   [[image:Photos.CdLSWorldbanners@${mathtool.random(1,
> 25)}.jpg||width="100%"]]
> {{/velocity}}
> If I add this same code in a stylesheet extension object:
>
> #document-title{
>     background:transparent
> url($doc.getAttachmentURL("Photos.CdLSWorldbanners@${mathtool.random(1,
> 25)}.jpg")) no-repeat scroll right center;
> }
>
> I get this result if I inspect the CSS in the browser:
> background:transparent
>
url(/xwiki/bin/download/Sandbox/change%2Ddocument/Photos.CdLSWorldbanners%407.jpg)
> no-repeat scroll right center
>
> Any suggestions if this CAN work, and if possible; what am I doing wrong?
>
> Gerritjan
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to