[Avatar][Embed] Change use of TemporaryFile::getPath to getRealPath

This commit is contained in:
Hugo Sales 2021-04-29 20:42:26 +00:00 committed by Diogo Peralta Cordeiro
parent 365a7b436f
commit ebfa0e2240
2 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ class Avatar extends Controller
if ($encoding_user == 'base64') {
$data_user = base64_decode($data_user);
$tempfile = new TemporaryFile('avatar');
$path = $tempfile->getPath();
$path = $tempfile->getRealPath();
file_put_contents($path, $data_user);
$sfile = new SymfonyFile($path);
} else {

View File

@ -337,12 +337,12 @@ END, ['embed' => $embed, 'attributes' => $attributes]);
$file = new TemporaryFile();
$file->write($imgData);
Event::handle('HashFile', [$file->getPathname(), &$hash]);
Event::handle('HashFile', [$file->getRealPath(), &$hash]);
$filepath = Common::config('storage', 'dir') . "embed/{$hash}" . Common::config('thumbnail', 'extension');
$width = Common::config('thumbnail', 'width');
$height = Common::config('thumbnail', 'height');
$smart_crop = Common::config('thumbnail', 'smart_crop');
Event::handle('ResizeImagePath', [$file->getPathname(), $filepath, $width, $height, $smart_crop, &$mimetype]);
Event::handle('ResizeImagePath', [$file->getRealPath(), $filepath, $width, $height, $smart_crop, &$mimetype]);
unset($file);