Drag an image from your desktop. Drop in on another image in a website. Boom, it's replaced! 8th Wonder of the world!
Let's show off with the demo!
Add Pictup to your scripts:
<script>https://cdn.rawgit.com/vinyll/anywhere/master/dist/anywhere.js</script>
Load Pictup on an image DOM:
<img src="/my/default/image.png" />
<script>
var img = document.querySelector('img');
new Pictup(img);
</script>
Now open you favorite browser and drag an image from your desktop onto the displayed image.
These options are available:
resize
: should the image be resized? defaults to truereplace
: should the dropped image replace the existing image? defaults to truemaxwidth
: if resized, what is the maimum width?maxheight
: if resized, what is the maimum height?
ready
: triggered when the image is loaded and resized (if applicable)