The Upload field doesn't store this info, only if you're using the Media Library. But if you're using uComponents there are a few XSLT Helper functions that I thnk you can use in Razor also. See the docs here, they have GetImageWidth(path) and GetImageHeight(path)
Get Width and height from Upload type in Razor
Hi I am using a Upload type in my Umbraco 4.9 solution, and want to display a picture and its width/heigt.
I use @Model.reelFrontImage to display the image it self, but can not figure out how to get the width and height - anybody who knows?
Thanks in advance :)
Thomas
Hi Thomas,
The Upload field doesn't store this info, only if you're using the Media Library. But if you're using uComponents there are a few XSLT Helper functions that I thnk you can use in Razor also. See the docs here, they have GetImageWidth(path) and GetImageHeight(path)
I think in Razor you could do this:
uComponents 4.x:
uComponents 5.x:
Hope this helps,
Tom
Perfect, works like a charm :)
Thank you so much
is working on a reply...