Skip to content

Add a demo on how to use dropzone#11

Open
mathiashelin wants to merge 3 commits intomasterfrom
add-dropzone
Open

Add a demo on how to use dropzone#11
mathiashelin wants to merge 3 commits intomasterfrom
add-dropzone

Conversation

@mathiashelin
Copy link
Contributor

No description provided.

}

// return the new filenames
$this->output(200, $return);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dit zou een iets properdere implementatie zijn. Het gebruikt geen global variables ($_FILES) en gebruikt de symfony methods om files te verplaatsen (moveFile)

Daarnaast is de extensie niet gehardcode. In jouw versie werd enkel jpeg ondersteund.

        $files = array_map(
            function ($file) {
                $filename = md5(uniqid() . time()) . '.' . $file->getClientOriginalExtension();
                $file->move(
                    FRONTEND_FILES_PATH . '/Profiles/acquisitions/source',
                    $filename
                );
                Model::generateThumbnails(
                    FRONTEND_FILES_PATH . '/Profiles/acquisitions/',
                    FRONTEND_FILES_PATH . '/Profiles/acquisitions/source/' . $filename
                );

                return $filename;
            },
            $this->get('request')->files->all()
        );

        $this->output(self::OK, $files);

console.log(image);
var realfile = {name: image.name, size: image.filesize, accepted: true};
dropzone.emit('addedfile', realfile);
dropzone.emit('thumbnail', image.url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

de tweede parameter is de file. de url is pas de derde parameter.

@WouterSioen WouterSioen removed their assignment Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants