Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

SOLVED: Getting Filename of a resized image in view


Reply

3 Posts   616 Views

Avatar
Silverfish

22 November 2011 at 5:22am (Last edited: 22 November 2011 5:22am), Community Member, 59 Posts

Hi All,

I'm looking for a way to geht just the path to an resized image in a template, i.e.

<div style="background:url($Img.SetWidth(100).Filename)"></div>

unfortunately when I'm writing it this way, I get

<div style="background:url(<img src="/path/to/image.jpg" alt="image" />.Filename)"></div>

Is it possible to get the filename without writing an extra method to the model?

Thanks for any hint!

Regards
SF

Avatar
rob.s

22 November 2011 at 8:03am (Last edited: 22 November 2011 8:04am), Community Member, 78 Posts

Hi Silverfish,

try

<div style="background-image: url(<% control Image.SetWidth(100) %>$URL<% end_control %>)"></div>

or

<div style="background-image: url(<% control Image %><% control SetWidth(100) %>$URL<% end_control %><% end_control %>)"></div>

Avatar
Silverfish

23 November 2011 at 12:34am Community Member, 59 Posts

Hi Rob,

The first one did the job, thanks a lot!

SF