This commit is contained in:
@ -4,8 +4,6 @@
|
||||
{{ encore_entry_link_tags('dropzone') }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block body %}
|
||||
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
|
||||
<form
|
||||
@ -25,8 +23,20 @@
|
||||
<script>
|
||||
window.parent.$(".modal-title").html("ETAPE 1 - Téléchargez votre image");
|
||||
|
||||
{% if idparent is defined %}
|
||||
function dropzoneinit( elmt ) {
|
||||
elmt.on("sending", function(file, xhr, formData) {
|
||||
formData.append("folder", "{{ idparent }}");
|
||||
});
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
function dropzonesuccess( file, response ) {
|
||||
{% if reportinput is defined %}
|
||||
$(location).attr('href',"{{ path('app_all_crop02', {"type": type, "reportinput": reportinput }) }}?file="+response["file"]);
|
||||
{% else %}
|
||||
$(location).attr('href',"{{ path('app_cropentity02', {"type": type, "idparent": idparent }) }}?file={{idparent}}/"+response["file"]);
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
|
@ -16,8 +16,12 @@
|
||||
{% set class="width:90px; height:90px;" %}
|
||||
{% elseif ratio=="16:9" %}
|
||||
{% set class="width:160px; height:90px;" %}
|
||||
{% elseif ratio=="16:4" %}
|
||||
{% set class="width:160px; height:40px;" %}
|
||||
{% elseif ratio=="16:2" %}
|
||||
{% set class="width:160px; height:20px;" %}
|
||||
{% elseif ratio=="4:6" %}
|
||||
{% set class="width:80px; height:120px;" %}
|
||||
{% endif %}
|
||||
|
||||
<div id='preview' style='overflow:hidden; {{class}} position: absolute; top: 0px; right: 10px;'>
|
||||
@ -60,27 +64,47 @@
|
||||
{% elseif ratio=="16:9" %}
|
||||
var scaleX = 160 / $('#form_w').val();
|
||||
var scaleY = 160 / $('#form_h').val();
|
||||
{% elseif ratio=="16:4" %}
|
||||
var scaleX = 160 / $('#form_w').val();
|
||||
var scaleY = 160 / $('#form_h').val();
|
||||
{% elseif ratio=="16:2" %}
|
||||
var scaleX = 160 / $('#form_w').val();
|
||||
var scaleY = 160 / $('#form_h').val();
|
||||
{% elseif ratio=="4:6" %}
|
||||
var scaleX = 80 / $('#form_w').val();
|
||||
var scaleY = 80 / $('#form_h').val();
|
||||
{% elseif ratio=="none" %}
|
||||
var scaleX = $('#form_ws').val();
|
||||
var scaleY = $('#form_hs').val();
|
||||
{% endif %}
|
||||
|
||||
$('#preview img').css({
|
||||
width: Math.round(scaleX * $('#largeimg').width()) + 'px',
|
||||
height: Math.round(scaleY * $('#largeimg').height()) + 'px',
|
||||
marginLeft: '-' + Math.round(scaleX * $('#form_x').val()) + 'px',
|
||||
marginTop: '-' + Math.round(scaleY * $('#form_y').val()) + 'px'
|
||||
});
|
||||
{% if ratio!="none" %}
|
||||
$('#preview img').css({
|
||||
width: Math.round(scaleX * $('#largeimg').width()) + 'px',
|
||||
height: Math.round(scaleY * $('#largeimg').height()) + 'px',
|
||||
marginLeft: '-' + Math.round(scaleX * $('#form_x').val()) + 'px',
|
||||
marginTop: '-' + Math.round(scaleY * $('#form_y').val()) + 'px'
|
||||
});
|
||||
{% else %}
|
||||
$('#preview img').css({
|
||||
width: '0px',
|
||||
height: '0px',
|
||||
marginLeft: '-0px',
|
||||
marginTop: '-0px'
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
}
|
||||
|
||||
function reportThumb() {
|
||||
{% if reportinput == "refresh" %}
|
||||
window.parent.location.reload();
|
||||
{% elseif reportinput != "none" %}
|
||||
window.parent.$("{{ reportinput }}").val("thumb_{{ file }}");
|
||||
window.parent.$("{{ reportinput }}_img").attr("src","{{ path("app_minio_image",{file:type~"/thumb_"~file}) }}");
|
||||
{% endif %}
|
||||
{%if reportinput is defined %}
|
||||
{% if reportinput == "refresh" %}
|
||||
window.parent.location.reload();
|
||||
{% elseif reportinput != "none" %}
|
||||
window.parent.$("{{ reportinput }}").val("thumb_{{ file }}");
|
||||
window.parent.$("{{ reportinput }}_img").attr("src","{{ path("app_minio_image",{file:type~"/thumb_"~file}) }}");
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
closeModal();
|
||||
}
|
||||
@ -114,8 +138,14 @@
|
||||
{% set nbratio=1 %}
|
||||
{% elseif ratio=="16:9" %}
|
||||
{% set nbratio=(16/9) %}
|
||||
{% elseif ratio=="16:4" %}
|
||||
{% set nbratio=(16/4) %}
|
||||
{% elseif ratio=="16:2" %}
|
||||
{% set nbratio=(16/2) %}
|
||||
{% elseif ratio=="4:6" %}
|
||||
{% set nbratio=0.7 %}
|
||||
{% elseif ratio=="none" %}
|
||||
{% set nbratio=null %}
|
||||
{% endif %}
|
||||
|
||||
$('#largeimg').CropSelectJs('setSelectionAspectRatio',{{nbratio}});
|
||||
|
Reference in New Issue
Block a user