Upload photo with vertical orientation & added remote file upload handler #746

Merged
carlosjr merged 4 commits from 3111-uploadPhoto_vertical into dev 2021-10-18 10:06:11 +00:00
3 changed files with 28 additions and 5 deletions

View File

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

View File

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

View File

@ -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
Import from external URL: Importar desde URL externa
This photo provider doesn't allow remote downloads: Este proveedor de fotos no permite descargas remotas