-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
// return the new filenames | ||
$this->output(200, $return); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
No description provided.