symlinked

This commit is contained in:
tracer 2022-11-15 16:59:31 +01:00
parent 3a322a7074
commit 4deaf39e89
1 changed files with 9 additions and 42 deletions

View File

@ -9,21 +9,6 @@ export default class extends Controller {
}
connect() {
console.log('image', this.avatarImageValue)
console.log('id', this.userIdValue)
/*
const formElement = document.getElementById('avatarDropzone')
const dzMessage = document.getElementsByClassName('dz-message')
formElement.style.backgroundImage = `url('${this.avatarImageValue}')`
formElement.style.backgroundRepeat = 'no-repeat'
formElement.style.backgroundPosition = 'center center'
formElement.style.backgroundSize = 'auto'
formElement.style.borderRadius = '25px'
console.log('formelement', formElement)
*/
console.log('init Dropzone')
let avatarDropzone = new Dropzone('#avatarDropzone', {
url: `/user/upload/avatar/${this.userIdValue}`,
avatarUrl: this.avatarImageValue,
@ -37,32 +22,14 @@ export default class extends Controller {
const callback = null // Optional callback when it's done
const crossOrigin = null // Added to the `img` tag for crossOrigin handling
const resizeThumbnail = false // Tells Dropzone whether it should resize the image first
avatarDropzone.displayExistingFile(mockFile, avatarDropzone.options.avatarUrl, callback, crossOrigin, resizeThumbnail);
avatarDropzone.files.push(mockFile); // line missing in official docs
/*
console.log('url', avatarDropzone.options.foo)
this.hiddenFileInput.removeAttribute('multiple')
this.on('maxfilesexceeded', (file) => {
this.removeAllFiles()
this.addFile(file)
})
this.on('error', (file, data) => {
console.log('error')
if (data.detail) {
this.emit('error', file, data.detail)
}
})
console.log('beforemock')
const mockFile = { name: 'Name Image', size: 12345, type: 'image/jpeg' }
this.emit('addedfile', mockFile)
this.emit('success', mockFile)
console.log('avi', this.avatarImageValue)
this.emit('thumbnail', mockFile, avatarDropzone.options.avatarUrl)
console.log('aftermock')
this.emit('complete', mockFile);
this.files.push(mockFile);
*/
avatarDropzone.displayExistingFile(
mockFile,
avatarDropzone.options.avatarUrl,
callback,
crossOrigin,
resizeThumbnail
)
avatarDropzone.files.push(mockFile) // line missing in official docs
},
transformFile(file, done) {
// Create the image editor overlay
@ -84,7 +51,7 @@ export default class extends Controller {
editor.appendChild(image)
// Create Cropper.js
const cropper = new Cropper(image, {aspectRatio: 1})
const cropper = new Cropper(image, { aspectRatio: 1 })
// Create confirm button at the top left of the viewport
const buttonCrop = document.createElement('button')