javascript - Transform images into a circular variant, changing circle size and place -
i love circular profile pictures, hate cant edit them. example dont want circle in middle , standard size, want smaller or something.
explanation pictures:
the 4 images, bottom top: input, image editor, moving circle, output
now, want put normal image in , there black overlay kind of opacity. in middle you'll have transparent circle can select part want in circle. can press save , there .png file made.
i thinking of doing jquery watermarks, couldn't figure out. got idea?
there couple of methods:
you can use css2/3 - corner-radius
(for newer browsers) or overlay image, image can cropped, , background can scaled/moved via css background-position
, background-size
accordingly. save image, you'll need minimalistic php script do same operation server-side (given parameters) , output image user.
you can use html5 canvas - specification involves handy clip
method (which straightforward - limits drawn imagery current path), , can obtain image data via todataurl
method of canvas element long image uploaded same server (or cross-domain rules done right). minimal search on saving files js+html5 should further assist.
sample jsfiddle - http://jsfiddle.net/u2a7t/
Comments
Post a Comment