Image dimensions in templates?
is there a way to get the width & height of an image within a template?
I'm allowing my client to create ads, and would like to do something like this:
<a href="{{ item.data.ad_url }}" style="background-image: url({{ item.data.ad_image.url }}); width: {{ item.data.ad_image.width }}; height: {{ item.data.ad_image.height }};">
{{ item.data.ad_alt_text }}
</a>
I realize this might not be possible at the moment, but it would be quite handy.
Comments are currently closed for this discussion. You can start a new one.
2 Posted by John Nunemaker on 25 Jun, 2011 05:17 PM
If you piped the background image url through an image size you would always know the width and height. Are you expecting one ad to be a different size than another?
http://docs.harmonyapp.com/harmony-templates/filters/text-filters/#...
3 Posted by Kyle Fox on 25 Jun, 2011 05:21 PM
Thanks, I think that filter will work. Somehow missed it in the docs.
Kyle Fox closed this discussion on 25 Jun, 2011 05:21 PM.