rcrop icon indicating copy to clipboard operation
rcrop copied to clipboard

Image Preview Showing First image for all images while cropping

Open ravali527 opened this issue 7 years ago • 2 comments

I tried to replace the image and crop it again but while i save the image it's the first image that gets saved. Actually i have table with multiple images in td.if i click the image in td ..then the image will be opened in popup.if i resize the image the first image will displayed as preview for every image clicks. Can you please check this issue?

ravali527 avatar Aug 16 '17 05:08 ravali527

Hi! You have to destroy the instance and then create a new one for the new image. If you don't, rcrop has no clue of the change. Maybe in the near future I can add an method to update the image in case of replacements.

aewebsolutions avatar Aug 17 '17 20:08 aewebsolutions

Hello. Sorry to ressurect this topic but I have a similar issue. I tried your suggestion but could'nt make it work. I have an input type file to upload some pics. Once something as been uploded I create my rcrop instance like that :

$('.crop_preview').rcrop({ minSize : [127,127], preserveAspectRatio : true, grid : true}); };

After that I do my cropping and press a button that save the new pic and destroy the instance :

var srcResized = $('.crop_preview').rcrop('getDataURL', 100,100);
$('.info_modif .preview_pic').html('<img src="'+srcResized+'">');
$('.crop_preview').rcrop('destroy');

But Then when I upload my new pic I have an issue where the cropping grid and stuff doesn't appear. I just have my raw image. My code go through this again :

$('.crop_preview').rcrop({ minSize : [127,127], preserveAspectRatio : true, grid : true}); };

But no more cropping.

Do you have any idea ?

Btw amazing plugin. Very useful 👍

ThomasPalamara avatar Mar 07 '18 12:03 ThomasPalamara