EXIF の属性の 1 つで撮影時のカメラの向きの情報
- hackmylife / 2012-08-27: ExifのOrientationを見て画像を回転させる
jquery.exif.js と jquery-css-transform を用いて css3 の transform で回転させると以下のようになると思う。
.exifLoadEx(function(){ // alert($(this).exif("Orientation")); switch(parseInt($(this).exif("Orientation"))) { // @see http://hackmylife.net/archives/7400448.html case 1: break; // default case 2: $(this).css("transform", "rotateY(180deg) "); break; // hflip case 3: $(this).css("transform", " rotateZ(180deg)"); break; // 180 deg cw case 4: $(this).css("transform", "rotateY(180deg) rotateZ(180deg)"); break; // 180 deg cw and hflip case 5: $(this).css("transform", "rotateY(180deg) rotateZ( 90deg)"); break; // 90 deg cw and hflip case 6: $(this).css("transform", " rotateZ( 90deg)"); break; // 90 deg cw case 7: $(this).css("transform", "rotateY(180deg) rotateZ(270deg)"); break; // 270 deg cw and hflip case 8: $(this).css("transform", " rotateZ(270deg)"); break; // 270 deg cw } });
タグ
コメントをかく