mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-49627 core: Update uses of generate_image_thumbnail
This removes the need to write tempfiles in these locations.
This commit is contained in:
parent
b7067f065e
commit
2b53b13ff7
3 changed files with 5 additions and 16 deletions
|
@ -384,25 +384,19 @@ class file_storage {
|
|||
global $CFG;
|
||||
require_once($CFG->libdir.'/gdlib.php');
|
||||
|
||||
$tmproot = make_temp_directory('thumbnails');
|
||||
$tmpfilepath = $tmproot.'/'.$file->get_contenthash();
|
||||
$file->copy_content_to($tmpfilepath);
|
||||
|
||||
if ($mode === 'tinyicon') {
|
||||
$data = generate_image_thumbnail($tmpfilepath, 24, 24);
|
||||
$data = $file->generate_image_thumbnail(24, 24);
|
||||
|
||||
} else if ($mode === 'thumb') {
|
||||
$data = generate_image_thumbnail($tmpfilepath, 90, 90);
|
||||
$data = $file->generate_image_thumbnail(90, 90);
|
||||
|
||||
} else if ($mode === 'bigthumb') {
|
||||
$data = generate_image_thumbnail($tmpfilepath, 250, 250);
|
||||
$data = $file->generate_image_thumbnail(250, 250);
|
||||
|
||||
} else {
|
||||
throw new file_exception('storedfileproblem', 'Invalid preview mode requested');
|
||||
}
|
||||
|
||||
unlink($tmpfilepath);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue