Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a demo on how to use dropzone #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

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