1,JS處理.(火狐不支持),是通過圖片的style.filter來控制.
具體代碼
<html>
<head>
<title> </title>
<script type="text/javascript">
function rotateImage() {
imageToRotate = document.getElementById('imgRotate');
imageToRotate.style.filter= "progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')";
rotate()
}
var imageToRotate;
//定義旋轉度數,圖片太大,建義不要用
var degreeToRotate=360;
function rotate(){
var deg2radians = Math.PI * 2 / 360;
degreeToRotate++;
degreeToRotate=degreeToRotate%360;
rad = degreeToRotate * deg2radians ;
costheta = Math.cos(rad);
sintheta = Math.sin(rad);
imageToRotate.filters.item(0).M11 = costheta;
imageToRotate.filters.item(0).M12 = -sintheta;
imageToRotate.filters.item(0).M21 = sintheta;
imageToRotate.filters.item(0).M22 = costheta;
}
</script>
</head>
<body onload="rotateImage();">
<br />
<img id="imgRotate" src="test.JPG" />
</body>
</html>
2.也是JS處理
http://www.walterzorn.com/rotate_img/rotate_img.htm?A=90可以看看這個,外國做的,可以在火狐用,但是圖片過大也不行,JS會變慢.
大家可以參考一下,
3.已經在服務器已經生成了,只需要調用了,我在項目是用的Jmagick(功能很強大,有生成的縮略圖.加水印,旋轉....)
下篇文章介紹.
青菜貓
posted on 2008-04-08 22:51
青菜貓(孫宇) 閱讀(656)
評論(0) 編輯 收藏