[MEDIA] We need permissions to run chmod in directories

It's better to have in the filename data that we couldnt't otherwise rapidly retrieve
This commit is contained in:
Diogo Peralta Cordeiro 2021-07-22 12:32:49 +01:00 committed by Hugo Sales
parent 6ecdaa5d72
commit 72dcff22f7
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ class AttachmentThumbnail extends Entity
if (in_array($major_mime, array_keys($event_map)) && !Event::handle($event_map[$major_mime], [$attachment->getPath(), $temp->getRealPath(), &$width, &$height, $crop, &$mimetype])) {
$thumbnail->setWidth($predicted_width);
$thumbnail->setHeight($predicted_height);
$filename = "{$width}x{$height}{$ext}-" . $attachment->getFileHash();
$filename = "{$predicted_width}x{$predicted_height}{$ext}-" . $attachment->getFileHash();
$temp->move(Common::config('thumbnail', 'dir'), $filename);
$thumbnail->setFilename($filename);
DB::persist($thumbnail);

View File

@ -145,7 +145,7 @@ class TemporaryFile extends \SplFileInfo
*
* @return void
*/
public function move(string $directory, string $filename, int $dirmode = 0655, int $filemode = 0644): void
public function move(string $directory, string $filename, int $dirmode = 0755, int $filemode = 0644): void
{
if (!is_dir($directory)) {
if (false === @mkdir($directory, $dirmode, true) && !is_dir($directory)) {