From 25128d16aace10b0ee7e4cdb05367e5d4223a9ce Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 11 Aug 2020 14:50:06 +0200 Subject: [PATCH] MDL-61215 core_user: use the new optimised_image filetype group For the user profile picture (instead of the web_image which includes SVG files). --- user/edit.php | 2 +- user/editadvanced.php | 2 +- user/externallib.php | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/user/edit.php b/user/edit.php index 7fc19ffb94e..ec1a81fba18 100644 --- a/user/edit.php +++ b/user/edit.php @@ -165,7 +165,7 @@ $filemanagercontext = $editoroptions['context']; $filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, - 'accepted_types' => 'web_image'); + 'accepted_types' => 'optimised_image'); file_prepare_draft_area($draftitemid, $filemanagercontext->id, 'user', 'newicon', 0, $filemanageroptions); $user->imagefile = $draftitemid; // Create form. diff --git a/user/editadvanced.php b/user/editadvanced.php index 07fc5e06315..fea54a6bf08 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -145,7 +145,7 @@ $filemanagercontext = $editoroptions['context']; $filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, - 'accepted_types' => 'web_image'); + 'accepted_types' => 'optimised_image'); file_prepare_draft_area($draftitemid, $filemanagercontext->id, 'user', 'newicon', 0, $filemanageroptions); $user->imagefile = $draftitemid; // Create form. diff --git a/user/externallib.php b/user/externallib.php index 0d7daad5fa5..90c9bd423db 100644 --- a/user/externallib.php +++ b/user/externallib.php @@ -574,7 +574,7 @@ class core_user_external extends external_api { $filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, - 'accepted_types' => 'web_image'); + 'accepted_types' => 'optimised_image'); $transaction = $DB->start_delegated_transaction(); @@ -1707,7 +1707,12 @@ class core_user_external extends external_api { throw new moodle_exception('noprofileedit', 'auth'); } - $filemanageroptions = array('maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => 'web_image'); + $filemanageroptions = array( + 'maxbytes' => $CFG->maxbytes, + 'subdirs' => 0, + 'maxfiles' => 1, + 'accepted_types' => 'optimised_image' + ); $user->deletepicture = $params['delete']; $user->imagefile = $params['draftitemid']; $success = core_user::update_picture($user, $filemanageroptions);