feat(uploadPhoto: Upload photo with vertical orientation & added remote file upload handler
gitea/salix/pipeline/head This commit looks good Details

Refs: 3111
This commit is contained in:
Joan Sanchez 2021-10-11 08:03:24 +02:00
parent 3d57e9a618
commit e59acf2080
3 changed files with 28 additions and 5 deletions

View File

@ -61,7 +61,7 @@
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
label="Type" label="Orientation"
ng-model="$ctrl.viewportType" ng-model="$ctrl.viewportType"
data="$ctrl.viewportTypes" data="$ctrl.viewportTypes"
selection="$ctrl.viewportSelection" selection="$ctrl.viewportSelection"

View File

@ -36,6 +36,18 @@ export default class UploadPhoto extends Component {
width: 1350, width: 1350,
height: 900 height: 900
} }
},
{
code: 'vertical',
description: this.$t('Vertical'),
viewport: {
width: 306.66,
height: 533.33
},
output: {
width: 460,
height: 800
}
} }
]; ];
this.viewportType = 'normal'; this.viewportType = 'normal';
@ -103,8 +115,17 @@ export default class UploadPhoto extends Component {
const reader = new FileReader(); const reader = new FileReader();
reader.onload = e => this.editor.bind({url: e.target.result}); reader.onload = e => this.editor.bind({url: e.target.result});
reader.readAsDataURL(value); reader.readAsDataURL(value);
} else if (this.uploadMethod == 'URL') } else if (this.uploadMethod == 'URL') {
this.editor.bind({url: value}); 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`)
);
};
}
} }
} }

View File

@ -3,6 +3,8 @@ Select an image: Selecciona una imagen
File name: Nombre del fichero File name: Nombre del fichero
Rotate left: Girar a la izquierda Rotate left: Girar a la izquierda
Rotate right: Girar a la derecha Rotate right: Girar a la derecha
Panoramic: Panorámico Panoramic: Panorámica
Orientation: Orientación
Select from computer: Seleccionar desde ordenador Select from computer: Seleccionar desde ordenador
Import from external URL: Importar desde URL externa Import from external URL: Importar desde URL externa
This photo provider doesn't allow remote downloads: Este proveedor de fotos no permite descargas remotas