nope, it's not stored, only the file reference is stored... so you'd need to either store it on the media section and use a media picker to reference the media item, or get the info dynamically using the Bitmap class.
Last solution will be overkill, unless you wire up an even that fires when saving/publishing a doc that holds the upload field and add some additional image info such as width and height as labels on your doc type.
@Lee, sounds ok to get width and height for just one pic, but not if that's inside a loop, seems to be some overkill to do so many io operations on the bitmap...
So on my document type with the property "image" (upload) i just add "umbracoExtension", "umbracoBytes", "umbracoWidth" and "umbracoHeight" properties?
What type do I select for each of those?
Ye... I'm new at this, but as i learn, Umbraco gets more and more awesome... like double-rainbow-awesome...
How to get image width and height using Upload?
Trying to make a list of images with Xslt and the Upload function on my doctype...
The list works fine in say Google Chrome but not in IE9 because it needs the width and height of the images.
Does the upload-function not store these informations and only the image or can i somehow get these values into my Xstl?
nope, it's not stored, only the file reference is stored... so you'd need to either store it on the media section and use a media picker to reference the media item, or get the info dynamically using the Bitmap class.
Last solution will be overkill, unless you wire up an even that fires when saving/publishing a doc that holds the upload field and add some additional image info such as width and height as labels on your doc type.
Cheers,
/Dirk
Hi Crawn,
If you add the following properties to your document-type, then Umbraco will auto-populate them:
This is how it works for the Image media-type.
Cheers, Lee.
Doh, should've known that one... Big thanks for reminding me Lee :D
Cheers,
/Dirk
No worries Dirk... I cracked open Reflector to double-check! ;-)
... another one to throw out there. In the uComponents XsltExtension for Media, we have a few methods:
or to get the height/width directly, use these:
Cheers, Lee.
@Lee, sounds ok to get width and height for just one pic, but not if that's inside a loop, seems to be some overkill to do so many io operations on the bitmap...
Cheers,
/Dirk
I wholeheartedly agree! I'd go with the "umbraco*" alias prefixes, stored the data at upload/save time.
Hi...
So on my document type with the property "image" (upload) i just add "umbracoExtension", "umbracoBytes", "umbracoWidth" and "umbracoHeight" properties?
What type do I select for each of those?
Ye... I'm new at this, but as i learn, Umbraco gets more and more awesome... like double-rainbow-awesome...
Thx for your time....
Cheers
Crawn
Have a look at the image media type in the settings section, you must copy alias and type, name can be anything for each of the umbraco* properties.
Cheers,
/Dirk
Bloody awesome, thx guys... so very simple... when you know it!
Thx!...
Cheers
Crawn
is working on a reply...