and-rej / rotate-and-zoom-image

Is there a picture with wrong orientation, or just displayed too small? Rotate or zoom images directly on any website, just one in the context menu.
https://addons.mozilla.org/firefox/addon/rotate-and-zoom-image/
Mozilla Public License 2.0
16 stars 2 forks source link

Support background images #4

Closed MikkCZ closed 6 years ago

MikkCZ commented 7 years ago

A lot of websites today (including mozilla.org) do not use <img> tags, but include the some images via CSS background. This should be also supported to rotate or zoom.

So instead of checking if the element is <img>, I should include a check for background image, and find a way, how to rotate/zoom it possibly without moving the element itself and its content.

MikkCZ commented 7 years ago

OK, looking at the CSS specs, this is not easily possible. But one option is to use Image and make a transformed copy of the image to replace the original (and save the original to some data attribute of the modified element).

One other drawback is I need to register context menu for other elements than just images, which may be confusing for the users, when the see entry in the context menu, even if they haven't clicked an image. I may just use a completely different context menu for rotating background of the clicked element.