From e59acf20800e327c26efa97d4524843326fbb493 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 11 Oct 2021 08:03:24 +0200 Subject: [PATCH] feat(uploadPhoto: Upload photo with vertical orientation & added remote file upload handler Refs: 3111 --- .../salix/components/upload-photo/index.html | 2 +- front/salix/components/upload-photo/index.js | 25 +++++++++++++++++-- .../components/upload-photo/locale/es.yml | 6 +++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/front/salix/components/upload-photo/index.html b/front/salix/components/upload-photo/index.html index 3dd6cdb27..9b64a380f 100644 --- a/front/salix/components/upload-photo/index.html +++ b/front/salix/components/upload-photo/index.html @@ -61,7 +61,7 @@ this.editor.bind({url: e.target.result}); reader.readAsDataURL(value); - } else if (this.uploadMethod == 'URL') - this.editor.bind({url: value}); + } else if (this.uploadMethod == 'URL') { + const img = new Image(); + img.crossOrigin = 'Anonymous'; + img.src = value; + img.onload = () => this.editor.bind({url: value}); + img.onerror = () => { + this.vnApp.showError( + this.$t(`This photo provider doesn't allow remote downloads`) + ); + }; + } } } diff --git a/front/salix/components/upload-photo/locale/es.yml b/front/salix/components/upload-photo/locale/es.yml index bcc3801d8..398e5172e 100644 --- a/front/salix/components/upload-photo/locale/es.yml +++ b/front/salix/components/upload-photo/locale/es.yml @@ -3,6 +3,8 @@ Select an image: Selecciona una imagen File name: Nombre del fichero Rotate left: Girar a la izquierda Rotate right: Girar a la derecha -Panoramic: Panorámico +Panoramic: Panorámica +Orientation: Orientación Select from computer: Seleccionar desde ordenador -Import from external URL: Importar desde URL externa \ No newline at end of file +Import from external URL: Importar desde URL externa +This photo provider doesn't allow remote downloads: Este proveedor de fotos no permite descargas remotas \ No newline at end of file -- 2.40.1