Commit c70e4260 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1834470: Profile picture generates error when uploaded to Image Gallery."

parents 9c1d11c2 99c88532
......@@ -610,7 +610,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
if (!empty($values['images'])) {
foreach ($values['images'] as $id) {
$image = new ArtefactTypeImage($id);
$image = artefact_instance_from_id($id);
if (!($image instanceof ArtefactTypeImage) || !$USER->can_view_artefact($image)) {
$result['message'] = get_string('unrecoverableerror', 'error');
$form->set_error(null, $result['message']);
......
......@@ -194,7 +194,6 @@ function pieform_element_filebrowser(Pieform $form, $element) {
$_PIEFORM_FILEBROWSERS[$prefix]['views_js'] = $initjs;
$initjs .= "jQuery({$prefix}.init);";
$initjs .= "upload_max_filesize = '" . get_real_size(ini_get('upload_max_filesize')) . "';";
if ($form->is_submitted() && $form->has_errors()) {
// need to reapply bootstrap file browser stuff
$initjs .= "jQuery('.js-filebrowser').each(function() {";
......@@ -1654,6 +1653,7 @@ function pieform_element_filebrowser_get_headdata($element) {
'<script src="' . get_config('wwwroot') . 'artefact/file/js/filebrowser.js?v=' . $cacheversion . '"></script>');
if ($element['config']['upload']) {
// only add dropzone if filebrowser is allowed to upload
$headdata[] = '<script>var upload_max_filesize = ' . get_real_size(ini_get('upload_max_filesize')) . '</script>';
$headdata[] = '<script src="' . get_config('wwwroot') . 'js/dropzone/min/dropzone.min.js?v=' . $cacheversion . '"></script>';
$headdata[] = '<script src="' . get_config('wwwroot') . 'artefact/file/js/filedropzone.js?v=' . $cacheversion . '"></script>';
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment