255
Views
3
Comments
use javascript to rotate image
Question

hi everybody


how use javascript to rotate image? Any exemple please!

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Silva,

You do not need javascript for that, you can do this purely with CSS, for example to rotate 180 degrees create the following class that you can apply to the image.

.rotateimg180 {
  -webkit-transform:rotate(180deg);
  -moz-transform: rotate(180deg);
  -ms-transform: rotate(180deg);
  -o-transform: rotate(180deg);
  transform: rotate(180deg);
}

Regards,

Daniel

UserImage.jpg
silva lima

Daniël Kuhlmann wrote:

Hi Silva,

You do not need javascript for that, you can do this purely with CSS, for example to rotate 180 degrees create the following class that you can apply to the image.

.rotateimg180 {
  -webkit-transform:rotate(180deg);
  -moz-transform: rotate(180deg);
  -ms-transform: rotate(180deg);
  -o-transform: rotate(180deg);
  transform: rotate(180deg);
}

Regards,

Daniel

Daniel thanks for the reply.
But I expressed myself badly. Sorry.

I need to rotate the image 90º by clicking a button. Then save this image as it rotates.


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

What type of application are you developing,  Traditional Web, Reactive Web or Mobile?

For doing it in the browser with javascript have a look at:http://jsfiddle.net/6ZsCz/803/ which users the HTML canvas element to achieve the rotation.

For traditional web, you could also consider to do the rotation at the server using the following Forge components: 

Regards,

Daniel

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.