ASP.NET - How to extend an image size using div control?

Asked By Eswaran Radhakrishnan on 15-May-09 12:27 AM

hi ,

I have an image which size is small. I display the image using div control in *.aspx page. I need to extend the image size from it's orginal size.

How to extend an image size using div control?


thanks

R. eswaran.


check this - sri sri replied to Eswaran Radhakrishnan on 15-May-09 12:33 AM

hi,

set height and width for the image

Re - Ravenet Rasaiyah replied to Eswaran Radhakrishnan on 15-May-09 12:39 AM

Hi

To this  you need get  new size from the ordinal image using Image class.

Like this way

HTML

<div>
        <asp:Label ID="label2" runat="server" Text="Thumbnail Small Image (50x50)px: " ForeColor="navy" Width="220"></asp:Label>
        <asp:Image ID="
ThumbnailImageS" runat="server" />
    </div>

Next we need set image url to this
ThumbnailImageS

Inline code

System.Drawing.Image bmp1 = img1.GetThumbnailImage(50, 50, null, IntPtr.Zero);
// save to palce then assgin file to image control
ThumbnailImageS.Image= newFileName;

Look here more information
http://www.c-sharpcorner.com/UploadFile/prathore/MakeThumbnail02122009060943AM/MakeThumbnail.aspx

http://www.codeproject.com/KB/web-image/ThumbViewerControl.aspx?display=Print
thank you

Santhosh N replied to Eswaran Radhakrishnan on 15-May-09 12:41 AM

You could do this using CSS style for the Div tag..

<div style="height: 100; width:200"...>

But, its always better to change the height and width of the source image using any image editing softwares like photoshop to have the same clarity, and the clarity will be lost if you try to manipulate the size in the webpage...


re - Rao B replied to Eswaran Radhakrishnan on 15-May-09 12:43 AM

you can set the height and width 100%

For more details see the link

http://webdesign.about.com/od/css3/f/blfaqbgsize.htm

Alice J replied to Eswaran Radhakrishnan on 15-May-09 12:56 AM

Follow this code. Just hard code the image size you require in the style attribute.

<div id="mydiv" style="border:1px solid black; width:200px; height:300px"><img src="http://www.google.com/intl/en/images/logo.gif" onload="this.style.width=document.getElementById('mydiv').style.width; this.style.height=document.getElementById('mydiv').style.height;"/></div>

Re - Arun D replied to Eswaran Radhakrishnan on 15-May-09 01:42 AM

Try this....

<asp:Image ID="Image1" runat="server" BorderColor="#000066" style="cursor:star;"

onmouseover="this.style.height='500px',this.style.width='500px'"

onmouseout="this.style.height='180px',this.style.width='190px'" alt="No-Image"

BorderWidth="2px" Height="81px" Width="90px" />