Developer forum

Forum » Feature requests » Container width available in DwTemplateTags

Container width available in DwTemplateTags

Jaocb Bertelsen
Reply
Hi there,

It would be nice, if I could scale an image in a paragraph, according to the width of the placeholder it is in.

Instead of creating x paragraph-templates, and hardcoding the width:
(example img src given)
Admin/Public/GetImage.aspx?Image=/Billeder/salesCampaignShopImages/shop11/DSC00651.JPG&Width=340&Resolution=75&Compression=90

, I think it would be cool to be able to do like this:
Admin/Public/GetImage.aspx?Image=/Billeder/salesCampaignShopImages/shop11/DSC00651.JPG&Width=<--@DwCurrentPlaceholderWidth-->&Resolution=75&Compression=90

I imagine the placeholder width could be placed with the settings, for instance:
<div class="dwcontent" id="maincolumn" title="Main column" settings="width: 350;template:Designs/Paragraph/Left.html"></div>

I am sure, that image scaling in paragraphs is not the only way, that a placeholderwidth-variable could be used.


Replies

 
David Matheson
Reply
Hi Jacob,

Sten Hougaard has posted a method for doing this using jQuery on http://www.dwfeatures.com/2011/06/05/automatic-adapt-image-width/