You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I send ajax request in cropper.js on click event and delete image may be it will be useful for someone:
.on('click', '.delete-photo', function () {
$.ajax({
method: "POST",
url: '/admin/news/deletephoto',
dataType: "html",
data: {crop : cropper.$thumbnail.attr('src')},
success: function(html){
alert(html);
}
});
cropper.deletePhoto();
})
example of implementation on server side:
if(Yii::$app->request->isAjax) {
$img = $_SERVER['DOCUMENT_ROOT'].$_POST['crop'];
if(file_exists($img)) {
unlink($img);
return "Şəkil müvəfəqiyyətlə silindi";
}
else return "Belə bir şəkil yoxdur";
}
It doesn't delete file when clicking Delete photo but only image from preview. How can I make it delete cropped image file.
The text was updated successfully, but these errors were encountered: