This is a migrated thread and some comments may be shown as answers.

Using ResizeMode="Fit" with ImageUrl

2 Answers 234 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 01 Nov 2010, 09:54 PM
Accordining to http://www.telerik.com/help/aspnet-ajax/radbinaryimage.html 
"ReziseMode" specifies whether the image should be sized automatically if width and height of the image are set in pixels. Possible values are:
  • Crop (the image will be trimmed)
  • Fit (the image will be sized to fit the given dimensions)
  • None (default)

Using the code

<

 

telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" ImageUrl="Photo/Grid-Scrolling-Issue.jpg" ResizeMode="Fit" Height="100px" Width="100px"/>

 


Renders

<img id="RadBinaryImage1" src="Photo/Grid-Scrolling-Issue.jpg" style="height:100px;width:100px;" />

and the image is 100x100 px on the page

However, the file size downloaded to the browser is still its original file sze 1.25MB; which is not what we were hoping for. We would like to use the control to produce a thumbnail image that has a small file size and dimensions.Can this be done with the Binary image control?

Our images are files on the server and not in a DB; that is why we went the ImageURL approach.

Can the actual image size be reduced along with it's dimensions with this control, if so how?

Thanks in advance,

K.E.

2 Answers, 1 is accepted

Sort by
0
Craig Mellon
Top achievements
Rank 1
answered on 03 Nov 2010, 11:33 AM
I'm not so sure but I think you would do this on this fly - nothing to do with the Binary image control.

As you know your image is allways going to be 100px by 100px resize the image to those dimensions before the RAD control renders the image, try this: Resize on fly
0
Cori
Top achievements
Rank 2
answered on 18 Nov 2010, 02:12 PM
Hello Keith,

I ResizeMode, I believe is only used when you have an image in the database, so it resizes the image and only sends an image with that size to the broswer. The ImageUrl property, I believe is just a fail-safe in case the image doesn't exists in the database. Almost like a default image to show when the correct image couldn't be found.

I hope that helps.
Tags
BinaryImage
Asked by
Keith
Top achievements
Rank 1
Answers by
Craig Mellon
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Share this question
or