Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Image rotation (http://www.programmingforums.org/showthread.php?t=12982)

InfoGeek Apr 12th, 2007 12:37 AM

Image rotation
 
Hello everybody,

I'm working on a project where we need to rotate an image at 90 degrees. I've got this already written:
:

        function rotateMyImage() {
            var rotBy = $("rotBy").value;           
            rotBy = parseInt(rotBy) + 1;
            if(rotBy==4) rotBy = 0;
            $("rotBy").value = rotBy;                       
                           
            oDiv.style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=' + rotBy + ')';
            odivinmyImg.style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=' + rotBy + ')';
        }


I've searched on the internet and found out that this code is IE specific. I need something that works at least in IE and Firefox. Can't seem to find anything on the net. Any ideas how to go about this?

Game_Ender Apr 12th, 2007 2:16 AM

I don't know much about web programming, but how could a method name with 'Microsoft' be in any way portable? Try this code.

InfoGeek Apr 12th, 2007 2:42 AM

I've seen this earlier. It's not what I'm looking for. I've to rotate large images and not small icons. And It's written in javascript which is going to be very slow.

Game_Ender Apr 12th, 2007 1:09 PM

Well, when in doubt Google. You should use the canvas element on Firefox and Safari, but leave the DirectX functions for IE. See more here: http://cow.neondragon.net/index.php/...ascript?page=6

InfoGeek Apr 13th, 2007 12:03 AM

Thanks a lot Game_Ender. It seems the way to go. I'm looking into it now.


All times are GMT -5. The time now is 2:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC