From a6b085d746a1161c45ae5bb6e091e30af05668ef Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 23 Feb 2015 19:57:00 +0100 Subject: [PATCH] Generally applying 0644 on all thumbnail images is maybe not what all people like, so better make it configurable. Signed-off-by: Roland Haeder --- lib/default.php | 1 + lib/imagefile.php | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/default.php b/lib/default.php index 6d6677f287..987c9bd639 100644 --- a/lib/default.php +++ b/lib/default.php @@ -256,6 +256,7 @@ $default = ), 'thumbnail' => array('crop' => false, // overridden to true if thumb height === null + 'chmod' => 0644, // Access rights (chmod) for created thumbnail images 'maxsize' => 1000, // thumbs with an edge larger than this will not be generated 'width' => 450, 'height' => 600, diff --git a/lib/imagefile.php b/lib/imagefile.php index d040a4b270..80cd9023cd 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -253,6 +253,9 @@ class ImageFile if ($this->rotate == 0) { // No rotational difference, just copy it as-is @copy($this->filepath, $outpath); + + // And set chmod + @chmod($outpath, common_config('thumbnail', 'chmod'); return $outpath; } elseif (abs($this->rotate) == 90) { // Box is rotated 90 degrees in either direction, @@ -351,8 +354,8 @@ class ImageFile throw new Exception(_('Unknown file type')); } - // Always chmod 0644 to have other processes (e.g. queue daemon read it) - @chmod($outpath, 0644); + // Always chmod 0644 (default) to have other processes (e.g. queue daemon read it) + @chmod($outpath, common_config('thumbnail', 'chmod'); imagedestroy($image_src); imagedestroy($image_dest); -- 2.39.5