From f7cf600fe1abc92ddccdbadf30315d6f9785994f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 8 Jul 2020 20:51:27 +0200 Subject: adding videos to the database --- .../views/media/components/media.formImage.js | 64 ++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) (limited to 'animism-align/frontend/views/media/components/media.formImage.js') diff --git a/animism-align/frontend/views/media/components/media.formImage.js b/animism-align/frontend/views/media/components/media.formImage.js index b3d227e..c757d03 100644 --- a/animism-align/frontend/views/media/components/media.formImage.js +++ b/animism-align/frontend/views/media/components/media.formImage.js @@ -4,7 +4,9 @@ import { Link } from 'react-router-dom' import { session } from '../../../session' import { capitalize } from '../../../util' -import { TextInput, LabelDescription, Select, TextArea, Checkbox, SubmitButton, Loader } from '../../../common' +import { TextInput, LabelDescription, FileInputField, Select, TextArea, Checkbox, SubmitButton, Loader } from '../../../common' + +import { ImageSelection } from './media.formImageSelection' export default class MediaImageForm extends Component { state = { @@ -15,9 +17,7 @@ export default class MediaImageForm extends Component { this.handleSelect = this.handleSelect.bind(this) this.handleChange = this.handleChange.bind(this) this.handleSettingsChange = this.handleSettingsChange.bind(this) - } - - componentDidMount() { + this.handleUpload = this.handleUpload.bind(this) } handleChange(e) { @@ -33,11 +33,67 @@ export default class MediaImageForm extends Component { this.props.onSettingsChange(name, value) } + handleUpload(image) { + // upload fullsize + this.uploadFullSize(image) + .then(res => { + this.props.onSettingsChange('fullsize', data.res) + setTimeout(() => { + }) + }) + } + + uploadFullSize(image) { + actions.upload.upload({ + image, + tag: 'fullsize', + username: 'animism', + }).then(data => { + console.log(data.res) + return data.res + }) + } + + uploadThumbnail(image) { + actions.upload.upload({ + image, + tag: 'thumbnail', + username: 'animism', + }).then(data => { + console.log(data.res) + }) + } + + uploadCrop(image) { + actions.upload.upload({ + image, + tag: 'crop', + username: 'animism', + }).then(data => { + console.log(data.res) + this.props.onSelect('url', data.res.url) + }) + } + render() { const { data } = this.props console.log(data) return (
+ {!data.url && + + } + {data.settings.fullsize && +
+ +
+ }
) } -- cgit v1.2.3-70-g09d2