- co-authored-by: mattwr18<mattwr18@gmail.com>
This commit is contained in:
Brent Vardy 2019-12-12 15:59:00 +00:00
parent 871c8e2aa3
commit e11c87aba6
2 changed files with 13 additions and 2 deletions

View File

@ -198,6 +198,7 @@ export default {
imageAspectRatio,
categoryIds,
} = this.form
console.log(teaserImage)
this.loading = true
this.$apollo
.mutate({

View File

@ -85,6 +85,16 @@ export default {
},
transformImage(file) {
this.file = file
this.thumbnailElement = document.querySelectorAll('#postdropzone')[0]
if (this.file.type === 'image/svg+xml') {
console.log(this.file)
this.image = new Image()
this.image.src = this.file.dataURL
this.image.classList.add('thumbnail-preview')
this.thumbnailElement.appendChild(this.image)
this.$emit('addTeaserImage', this.file)
return
}
this.showCropper = true
this.initEditor()
this.initCropper()
@ -95,7 +105,7 @@ export default {
this.thumbnailElement.appendChild(this.editor)
},
clearImages() {
this.thumbnailElement = document.querySelectorAll('#postdropzone')[0]
//this.thumbnailElement = document.querySelectorAll('#postdropzone')[0]
const thumbnailPreview = document.querySelectorAll('.thumbnail-preview')[0]
if (thumbnailPreview) thumbnailPreview.remove()
const contributionImage = document.querySelectorAll('.contribution-image')[0]
@ -118,7 +128,7 @@ export default {
const croppedImageFile = new File([blob], this.file.name, { type: this.file.type })
this.$emit('addTeaserImage', croppedImageFile)
this.$emit('addImageAspectRatio', imageAspectRatio)
}, 'image/jpeg')
}, this.file.type)
},
setupPreview(canvas) {
this.image = new Image()