Page 1 of 1

CGSmartimage & Background-image

Posted: Fri Dec 23, 2016 11:05 am
by musicscore
I want to define a (variable) background image in a div.
I use this code :

Code: Select all

<div class='news-image' style="background-color: transparent;background: url([[CGSmartImage src="\uploads\images\{$field->displayvalue}"  filter_croptofit="360,190,c"]]);"></div>
CGSmartimage should croptofit the background image

This is not working. The image is not shown at all.

Please help. What is wrong here.

Re: CGSmartimage & Background-image

Posted: Fri Dec 23, 2016 11:56 am
by Rolf
The use of [[ and ]] is only for in CMSMS stylesheets.
Use here the regular { and }.

Re: CGSmartimage & Background-image

Posted: Fri Dec 23, 2016 2:12 pm
by musicscore
Rolf,

I tryed that but then the <img> tag is added to the filename and the line is converted to

Code: Select all

<div class="news-image" style="background-image: url("<img ....
and this is not working.

Re: CGSmartimage & Background-image

Posted: Fri Dec 23, 2016 2:16 pm
by Rolf
Add notag=1 parameter (or something)

Re: CGSmartimage & Background-image

Posted: Fri Dec 23, 2016 4:52 pm
by musicscore
Rolf,

Thanks. You saved my day (and my idee).
Its working. (look at http://at2.dev-infowebs.nl

The images on top of the news-items are zooming on hover.

Thanks again Rolf