forked from GNUsocial/gnu-social
[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:
parent
6ecdaa5d72
commit
72dcff22f7
@ -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])) {
|
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->setWidth($predicted_width);
|
||||||
$thumbnail->setHeight($predicted_height);
|
$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);
|
$temp->move(Common::config('thumbnail', 'dir'), $filename);
|
||||||
$thumbnail->setFilename($filename);
|
$thumbnail->setFilename($filename);
|
||||||
DB::persist($thumbnail);
|
DB::persist($thumbnail);
|
||||||
|
@ -145,7 +145,7 @@ class TemporaryFile extends \SplFileInfo
|
|||||||
*
|
*
|
||||||
* @return void
|
* @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 (!is_dir($directory)) {
|
||||||
if (false === @mkdir($directory, $dirmode, true) && !is_dir($directory)) {
|
if (false === @mkdir($directory, $dirmode, true) && !is_dir($directory)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user