mirror of
https://github.com/MarcZierle/photo-log-frontend.git
synced 2025-04-07 13:04:37 +00:00
add autocrop to photo capture
This commit is contained in:
parent
2fa9b70bc2
commit
42a089eedb
@ -87,7 +87,7 @@ import {darkTheme} from 'naive-ui'
|
||||
import CreateNewFolderRound from '@vicons/material/CreateNewFolderRound'
|
||||
import HandPointUp from '@vicons/fa/HandPointUp'
|
||||
|
||||
import { getPhotoGroups, addNewPhotoGroup, addNewPhoto } from '@/api'
|
||||
import { getPhotoGroups, addNewPhotoGroup, addNewPhoto, cropPhoto } from '@/api'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -248,11 +248,19 @@ export default {
|
||||
|
||||
const file = dataURLtoFile(this.photo.src, 'upload.png')
|
||||
|
||||
addNewPhoto(file, null, this.selected_group).then(() => {
|
||||
addNewPhoto(file, null, this.selected_group).then((response) => {
|
||||
this.message.success('Done!')
|
||||
this.isPhotoTaken = false
|
||||
this.showPhotoTakenModal = false
|
||||
this.isUploading = false
|
||||
|
||||
setTimeout(() => {
|
||||
cropPhoto(response.data.id, 'auto').then(()=>{
|
||||
console.log('photo has been cropped')
|
||||
}).catch((error)=>{
|
||||
console.error(error)
|
||||
})
|
||||
}, 100)
|
||||
}).catch((error) => {
|
||||
this.message.error('There was an error uploading the photo: ' + error)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user