diff --git a/templates/web/admin/publications/fiche.html.twig b/templates/web/admin/publications/fiche.html.twig index 0d7f7ab51f..d53d912280 100644 --- a/templates/web/admin/publications/fiche.html.twig +++ b/templates/web/admin/publications/fiche.html.twig @@ -33,31 +33,36 @@ sequentialUploads: true, add: function (e, data) { $('#upload-error').empty(); - $.each(data.files, function (index, file) { - var fileType = /^image\/(gif|jpeg|png)$/; - if(typeof loadImage == 'function' && fileType.test(file.type)){ - if(file.size < 204800){ //200 ko - var options = { - maxWidth: 32, - maxHeight: 32, - minWidth: 32, - minHeight: 32 - }; + require([ + "blueimp.loadimage" + ], function (loadImage) { - data.oldImage = $("#img_before").get(0); + $.each(data.files, function (index, file) { + var fileType = /^image\/(gif|jpeg|png)$/; + if(typeof loadImage == 'function' && fileType.test(file.type)){ + if(file.size < 204800){ //200 ko + var options = { + maxWidth: 32, + maxHeight: 32, + minWidth: 32, + minHeight: 32 + }; - loadImage(file, function(img){ - $("#img_before").remove(); - $("#pub_icon .thumb_wrapper").append(img); - $("#pub_icon .thumb_wrapper img").attr("img_before"); - return false; - }, options); + data.oldImage = $("#img_before").get(0); - data.submit(); - } else { - $('#upload-error').empty().append(language.errorFileApiTooBig); + loadImage(file, function(img){ + $("#img_before").remove(); + $("#pub_icon .thumb_wrapper").append(img); + $("#pub_icon .thumb_wrapper img").attr("img_before"); + return false; + }, options); + + data.submit(); + } else { + $('#upload-error').empty().append(language.errorFileApiTooBig); + } } - } + }); }); }, done: function (e, data) { diff --git a/templates/web/admin/statusbit/edit.html.twig b/templates/web/admin/statusbit/edit.html.twig index 7330477824..4001a0626e 100644 --- a/templates/web/admin/statusbit/edit.html.twig +++ b/templates/web/admin/statusbit/edit.html.twig @@ -166,6 +166,7 @@