Contain post/contribution form to limit width

- enforce 1.25:1 aspect ratio to be as close to possible with the 1:1
aspect ratio on our root path where we have 3 columns of 300px and a
max-height of 300px
This commit is contained in:
mattwr18 2019-10-02 23:32:25 +02:00
parent db48e522cf
commit 3beddf1f69
2 changed files with 75 additions and 78 deletions

View File

@ -1,4 +1,5 @@
<template>
<ds-container width="medium">
<ds-form ref="contributionForm" v-model="form" :schema="formSchema">
<template slot-scope="{ errors }">
<hc-teaser-image :contribution="contribution" @addTeaserImage="addTeaserImage">
@ -68,6 +69,7 @@
</ds-card>
</template>
</ds-form>
</ds-container>
</template>
<script>
@ -262,7 +264,7 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.smallTag {
width: 100%;
position: relative;

View File

@ -94,12 +94,7 @@ export default {
confirm.textContent = this.$t('contribution.teaserImage.cropperConfirm')
confirm.addEventListener('click', () => {
// Get the canvas with image data from Cropper.js
let canvas = cropper.getCroppedCanvas({
minWidth: 256,
minHeight: 256,
maxWidth: 550,
maxHeight: 550,
})
let canvas = cropper.getCroppedCanvas()
canvas.toBlob(blob => {
this.$refs.el.manuallyAddFile(blob, canvas.toDataURL(), null, null, {
dontSubstractMaxFiles: false,
@ -121,7 +116,7 @@ export default {
image.src = URL.createObjectURL(file)
editor.appendChild(image)
// Create Cropper.js and pass image
let cropper = new Cropper(image, { aspectRatio: 16 / 9 })
let cropper = new Cropper(image, { aspectRatio: 1.25 / 1 })
},
dropzoneDrop() {
let cropOverlay = document.querySelectorAll('.crop-overlay')[0]
@ -213,11 +208,11 @@ export default {
}
.contribution-image {
max-height: 471px;
max-height: 620px;
}
.crop-overlay {
max-height: 471px;
max-height: 620px;
position: relative;
width: 100%;
// height: 100%;
@ -232,6 +227,6 @@ export default {
z-index: 9999;
}
.thumbnail-preview {
max-height: 471px;
max-height: 620px;
}
</style>