MDL-49627 core: Update uses of generate_image_thumbnail

This removes the need to write tempfiles in these locations.
This commit is contained in:
Andrew Nicols 2015-03-23 09:13:26 +08:00
parent b7067f065e
commit 2b53b13ff7
3 changed files with 5 additions and 16 deletions

View file

@ -290,11 +290,7 @@ function label_generate_resized_image(stored_file $file, $maxwidth, $maxheight)
$mimetype = $file->get_mimetype();
if ($mimetype === 'image/gif' or $mimetype === 'image/jpeg' or $mimetype === 'image/png') {
require_once($CFG->libdir.'/gdlib.php');
$tmproot = make_temp_directory('mod_label');
$tmpfilepath = $tmproot.'/'.$file->get_contenthash();
$file->copy_content_to($tmpfilepath);
$data = generate_image_thumbnail($tmpfilepath, $width, $height);
unlink($tmpfilepath);
$data = $file->generate_image_thumbnail($width, $height);
if (!empty($data)) {
$fs = get_file_storage();