Sitecore Image Parameters

Found a very strange behaviour with Sitecore image control,  take the following code

i would expect that would render the img tag with the correct height and width, but instead it renders out this

it overrides the height and width that i set and take the image height and width.. odd indeed

luckily we have a way to overcome this without having to use custom control or having to resort to image control – we would like the support the page editor functionality.

Set the parameters explicitly

That’s right,  we need to set the parameters explicitly so that it renders out the correct value.

First, remove the Height and Width attribute from the markup

then in the code behind

and here’s the result

Just like what i wanted.

If you’re wondering what other parameters are supported by the image control, you could find that in the Sitecore SDN

2 thoughts on “Sitecore Image Parameters

    1. unfortunately the version of sitecore that I’m using at that time was 7.2 so the security feature that was implemented for Sitecore 7.5 and above wasn’t the cause of it

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.