scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 307 forks source link

Suggestion : remove loaded image & preview #134

Open Pipozor opened 8 years ago

Pipozor commented 8 years ago

A function to remove the loaded image (and its preview) would be great. Like a reset of the container. Thanks

phpMagpie commented 8 years ago

This may be a duplicate of Issue #26

Pipozor commented 8 years ago

Hmm yes the issue is almost the same

$(".cropit-image-preview").css("background-image", "none"); is not completly working. the preview over the crop area is still displayed and it's not possible to reload the same picture.

I think a real clean up of the JS object is necessary :(

jpodpro commented 8 years ago

i just found a hack that allows adding of the same image after removing. you have to do 2 things on cancel:

$('.cropit-image-preview').css( 'background-image', 'none' );
$('.input.cropit-image-input')[0].value = null;
Pipozor commented 8 years ago

@jpodpro thank you very much for your idea. almost ok :) but it's not working very well for me : background main image is well removed and it's now possible to drop the same image but "background preview overflow" is still visible. any idea ?

Pipozor commented 8 years ago

edit: I found a solution

in addition to your above Js code, add this line $(".cropit-image-background").attr("src", "");

now everything is cleared. ^_^