November Happy Hour will be moved to Thursday December 5th.

ImageVault Resize Images

Vote:
 

Hi

i am using ImageVault in my application.

I want to resize image through c# code i.e i want to show existing image in less size without loosing quality.

Anybody has idea?

 

Thanks

Atul

#49287
Mar 11, 2011 12:13
Vote:
 

You can use ImageVault's UrlBuilder class to generate a link to a resized version of the image. If you have the URL to the original image (for example retrieved from an ImageVaultImage property) you can use it like this to return the URL to a resized version:

var ub = ImageStoreNET.Classes.Util.UrlBuilder.ParseUrl(imageUrl);
ub.Width = 400;
ub.PreserveAspectRatio = true;
return ub.ToString();

#49291
Mar 11, 2011 13:08
Vote:
 

Thanks Magnus

#49299
Mar 11, 2011 16:09
Vote:
 

Hi Magnus

I want to specify Height and Width in resize like

var ub = ImageStoreNET.Classes.Util.UrlBuilder.ParseUrl(imageUrl);
ub.Width = 636;

ub.Height=369

ub.PreserveAspectRatio = true;
return ub.ToString();

But i am not able to get resized image with specified size.Any idea?

 

#49687
Mar 29, 2011 6:25
Vote:
 

You can't force both Width and Height and preserve the aspect ratio, that would mean streching the pixels. I'm not sure which of width and height it will obey if you set it to preserve aspect ratio, but the output width/height ratio will be the same as the original width/height.

#49688
Mar 29, 2011 6:46
Vote:
 

Ok ,than i can specify Aspect Ration to achieve this

ub.Width = 636;

ub.Height = 369;

ub.AspectRatio=??

#49689
Mar 29, 2011 6:57
Vote:
 

If you want to distort the image I suppose you ould set Width, Height and then set PreserveAspectRatio to false.

#49694
Mar 29, 2011 8:36
Vote:
 

Thanks Magnus

I am able to get desired image.

One more thing,If i have Episerver Property

 <EPiServer:Property ID="imgTopImage" runat="server" PropertyName="TopImage" />

Than how we can do resizing because we are not able to set Url from codebehind?

 

 

 

 

 

 

#49781
Mar 31, 2011 11:01
Vote:
 

It responds to hidden attributes, fx.

<EPiServer:Property ImageWidth="100" ID="imgTopImage" runat="server" PropertyName="TopImage" />

#52645
Aug 08, 2011 12:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.