Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/public_html/web/admin/js/
Upload File :
Current File : /home/caballoscriollos/public_html/web/admin/js/modal_crop.js

var ratio = 15.4;
var minHeight = 426;
$(function() {
	$('.pop').on('click', function() {
		$('.imagepreview').attr('src', $(this).find('img').attr('src'));
		$('#imgID').val($(this).find('img').attr('id'))
		var $image = $('.imagepreview');
		$image.cropper('destroy');
		var options = {
		    aspectRatio: 23 / ratio,
		    minContainerWidth: 568,
		    minContainerHeight: minHeight,
		    zoomOnWheel: false,
		    autoCropArea: 1
		};

		$image.cropper(options);
		$('#imagemodal').modal('show');   
	});		
});

window.OpenCropper = function(id, url) {
	$('.imagepreview').attr('src', url);
	var $image = $('.imagepreview');
	$image.cropper('destroy');
	$('#imagemodal').modal('show');  
	$('#imagemodal').off('shown.bs.modal');
	$('#imagemodal').on('shown.bs.modal', function (e) {
		var options = {
			aspectRatio: 23 / ratio,
			initialAspectRatio: 23 / ratio,
			minContainerWidth: $('.modal-body').width(),
			responsive: true,
			zoomOnWheel: false,
		    autoCropArea: 1
		  };
		$image.cropper(options);  
		$('#btn-img-save').unbind('click');
		$('#btn-img-save').click(function() {
			SaveImage(id);
		});
	});
	$('#imagemodal').off('hidden.bs.modal');
	$('#imagemodal').on('hidden.bs.modal', function (e) {
		var file = document.getElementById("img-" + id);
		file.value = file.defaultValue;
	});
}

window.RotateLeft = function() {
	var $image = $('.imagepreview');
    var cropper = $image.data('cropper');
    cropper.rotate(-90);
}

window.RotateRight = function() {
	var $image = $('.imagepreview');
    var cropper = $image.data('cropper');
    cropper.rotate(90);
}

window.SaveImage = function(id){
	var $image = $('.imagepreview');
    var cropper = $image.data('cropper');
    var type = 'image/jpeg';
    
    if ($image[0].src.includes('png')) {
    	type = 'image/png';
    }

    var url = cropper.getCroppedCanvas().toDataURL(type);
	var hd = $('<input type="hidden" id="hd-' + id + '" data-id="' + id + '" class="hi-url" value="' + url + '" />');
    
    $("form[id*='uploadImageForm'], .custombox-modal-open form.resize-image").append(hd);
	$("#image-" + id).attr('src', url)
	$("#hd-" + id).val(url)
	$('#imagemodal').modal('hide');    
    $("#btn-rm-" + id).removeAttr('disabled');
}

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat