Several methods of rotating images in Asp.net

Source: Internet
Author: User

There are about four ways to rotate images in Asp. Net (personal opinions ).

1. filter effect through css

FlipV and FlipH can be found through google, but this method can only be fixed angle 90,180,270

 

2. Use javascript

Looking For A Long Time did not find a good js code, this http://www.walterzorn.com/rotate_img/rotate_img.htm effect is not bad,

However, if the image is slightly larger, the page may be slow. So small pictures are acceptable (QQ's expression icon is so big)

You can rotate any angle.

 

3. Rotate images through vml

This method is a good method. There are a lot of vml documents on google. Here we use the Rotation in vml, which works very well, even if it is a big image.

It will not be distorted. It can be any angle and does not need to be written into codebind.

 

4. Rotate images through GDI +

This method is also good. If you are not familiar with vml, GDI + is also a good choice. GDI + is the class library that comes with. Net Fromework. This benefit

It is to use codebind that everyone is familiar with to encode and rotate the Image and output it to Response, and then point the src of the Image to the url address of the write function.

This method can also be any angle.

 

I am using the "3rd" method. The following is a simple implementation of the method in "3rd" (from the expert Manual)

 

<Html xmlns: v = "urn: chemas-microsoft-com: vml" xmlns = "urn: chemas-microsoft-com ffice">
<Head>
<Title> Untitled Page </title>
<Style type = "text/css"> v/: * {behavior: url (# default # VML); display: inline-block} </style>
</Head>

<Body style = "background-color: #000000">
<Script type = "text/javascript" language = "javascript">
// This function updates the view for all objects that use the rotation function.
Function window. onload ()
{
Try {
For (I = 0; I <xuanzhuan. length; I ++)
Xuanzhuan [I]. Rotation = xuanzhuan [I]. xuanzhuanstr;
Xuanzhuan. Rotation = xuanzhuan. xuanzhuanstr
}
Catch (e)
{}
}
</Script>

<Table>
<Tr>
<Td>
<Div>
<V: Image id = xuanzhuan style = "Z-INDEX: 1001; LEFT: 290px; WIDTH: 157px; POSITION: absolute; TOP: 123px; HEIGHT: 105px "xuanzhuanstr =" 100 "src =" C:/Documents and Settings/paulhuang/My Documents ents/My Pictures/1.jpg" coordsize = "21600,21600"> </v: Image>
</Div>
</Td>
<Td>
<Div>
<V: Image id = xuanzhuan style = "Z-INDEX: 1001; LEFT: 435px; WIDTH: 157px; POSITION: absolute; TOP: 244px; HEIGHT: 105px "xuanzhuanstr =" 300 "src =" C:/Documents and Settings/paulhuang/My Documents/My Pictures/2.jpg" coordsize = "21600,21600"> </v: Image>
</Div>
</Td>

</Tr>
</Table>

</Body>
</Html>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.