Some how it would have to be manipulated to look for the "_thumb.jpg" code and display the "thumb" width and height instead of the original width and height.
I'm using Imagegen. I have an image gallery, that has a "High resolution" and "Low resolution" image download option.
The high resolution image is the original image uploaded, the low resolution is the JPG Imagegen cuts. _thumb_1024.jpg
I can display the width and height of the original, but need a way of displaying the width and height of the _thumb_1024.jpg
Here's how it displays on the front end: Low resolution image (2592 x 1944 px @ 72 dpi - RGB - 2.91 MB - jpg)
High resolution image (2592 x 1944 px @ - RGB - 2.91 MB - jpg)
Is it possible to display the _thumb_1024.jpg width and height? I'm thinking a C# method would probably work if I can't display the values any other way.
What I'm trying to do is get the size of the _thumb_1024.jpg. I know one of the values, width or height, will be 1024px. I need to find out how to calculate what other value is.
I realise that an image uploaded using Imagegen will create a jpg at 96 dpi.
So an image (3200 x 2400 px @ 300 dpi) when uploaded will create an image (1024 x 768 px @ 96 dpi).
I was hoping to just get the values of the _thumb_1024.jpg to use, but I think I'll have to use some Java or C# script to convert the umbracoWidth and umbracoHeight to suit an image with one value being 1024 px, and accounting for the change in 300 dpi and 96 dpi.
You could add thumb height, thumb with and thumb resolution as properties on the media type and use the Media.AfterSave event to update them. Then you'd only have to calulate it whenever the image is created or changed and not every time its displayed
How to display the image thumbnail width and height values?
I want to display the image thumbnail width and height values. How can I do this using:
Some how it would have to be manipulated to look for the "_thumb.jpg" code and display the "thumb" width and height instead of the original width and height.
Any ideas?
Cheers,
JV
Don't know off the top of my head but you could also use Imagegen to do exactly this, it's way more flexible too. Rich
Hi Rich,
I'm using Imagegen. I have an image gallery, that has a "High resolution" and "Low resolution" image download option.
The high resolution image is the original image uploaded, the low resolution is the JPG Imagegen cuts. _thumb_1024.jpg
I can display the width and height of the original, but need a way of displaying the width and height of the _thumb_1024.jpg
Here's how it displays on the front end:
Low resolution image
(2592 x 1944 px @ 72 dpi - RGB - 2.91 MB - jpg)
High resolution image
(2592 x 1944 px @ - RGB - 2.91 MB - jpg)
Is it possible to display the _thumb_1024.jpg width and height? I'm thinking a C# method would probably work if I can't display the values any other way.
in c#
int nodeId = 1234;
var media = new umbraco.cms.businesslogic.media.Media(nodeId);
var file = media.getProperty("umbracoFile");
string url = file.Value.ToString().Replace("jpg", "_thumb_1024.jpg");
Image img = Image.FromFile(HttpContext.Current.Server.MapPath(url));
string.Format("{0} * {1}",img.Size.Width, img.Size.Height);
Hey JV,
It seems like you are not using imagegen? If you are using imagegen to resize your image you know exactly the size they are going to be!
Prehaps I'm confused about what you're trying to do?
Rich
Hi Rich,
What I'm trying to do is get the size of the _thumb_1024.jpg. I know one of the values, width or height, will be 1024px. I need to find out how to calculate what other value is.
I realise that an image uploaded using Imagegen will create a jpg at 96 dpi.
So an image (3200 x 2400 px @ 300 dpi) when uploaded will create an image (1024 x 768 px @ 96 dpi).
I was hoping to just get the values of the _thumb_1024.jpg to use, but I think I'll have to use some Java or C# script to convert the umbracoWidth and umbracoHeight to suit an image with one value being 1024 px, and accounting for the change in 300 dpi and 96 dpi.
Cheers,
JV
You could add thumb height, thumb with and thumb resolution as properties on the media type and use the Media.AfterSave event to update them. Then you'd only have to calulate it whenever the image is created or changed and not every time its displayed
Hi David,
How do I add the the thumb height and thumb width to the media type? Do they have a special name? e.g. umbracoThumbWidth?
is working on a reply...