Skip to content

Commit

Permalink
Update image pipeline, use config_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Mar 12, 2024
1 parent ad506e9 commit a72188a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Jobs/ImageOptimizePipeline/ImageOptimize.php
Expand Up @@ -45,7 +45,7 @@ public function handle()
return;
}

if(config('pixelfed.optimize_image') == false) {
if((bool) config_cache('pixelfed.optimize_image') == false) {
ImageThumbnail::dispatch($media)->onQueue('mmo');
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/ImageOptimizePipeline/ImageResize.php
Expand Up @@ -51,7 +51,7 @@ public function handle()
return;
}

if(!config('pixelfed.optimize_image')) {
if((bool) config_cache('pixelfed.optimize_image') === false) {
ImageThumbnail::dispatch($media)->onQueue('mmo');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/ImageOptimizePipeline/ImageUpdate.php
Expand Up @@ -61,7 +61,7 @@ public function handle()
return;
}

if(config('pixelfed.optimize_image')) {
if((bool) config_cache('pixelfed.optimize_image')) {
if (in_array($media->mime, $this->protectedMimes) == true) {
ImageOptimizer::optimize($thumb);
if(!$media->skip_optimize) {
Expand Down
4 changes: 4 additions & 0 deletions app/Services/ConfigCacheService.php
Expand Up @@ -98,6 +98,10 @@ public static function get($key)
'captcha.triggers.login.enabled',
'captcha.triggers.login.attempts',
'federation.custom_emoji.enabled',

'pixelfed.optimize_image',
'pixelfed.optimize_video',
'pixelfed.max_collection_length',
// 'system.user_mode'
];

Expand Down
6 changes: 3 additions & 3 deletions app/Util/Site/Config.php
Expand Up @@ -36,10 +36,10 @@ public static function get()
'album_limit' => (int) config_cache('pixelfed.max_album_length'),
'image_quality' => (int) config_cache('pixelfed.image_quality'),

'max_collection_length' => (int) config('pixelfed.max_collection_length', 18),
'max_collection_length' => (int) config_cache('pixelfed.max_collection_length', 18),

'optimize_image' => (bool) config('pixelfed.optimize_image'),
'optimize_video' => (bool) config('pixelfed.optimize_video'),
'optimize_image' => (bool) config_cache('pixelfed.optimize_image'),
'optimize_video' => (bool) config_cache('pixelfed.optimize_video'),

'media_types' => config_cache('pixelfed.media_types'),
'mime_types' => config_cache('pixelfed.media_types') ? explode(',', config_cache('pixelfed.media_types')) : [],
Expand Down
4 changes: 2 additions & 2 deletions resources/views/admin/diagnostics/home.blade.php
Expand Up @@ -750,12 +750,12 @@
<tr>
<td><span class="badge badge-primary">PIXELFED</span></td>
<td><strong>PF_OPTIMIZE_IMAGES</strong></td>
<td><span>{{config_cache('pixelfed.optimize_image') ? '✅ true' : '❌ false' }}</span></td>
<td><span>{{(bool) config_cache('pixelfed.optimize_image') ? '✅ true' : '❌ false' }}</span></td>
</tr>
<tr>
<td><span class="badge badge-primary">PIXELFED</span></td>
<td><strong>PF_OPTIMIZE_VIDEOS</strong></td>
<td><span>{{config_cache('pixelfed.optimize_video') ? '✅ true' : '❌ false' }}</span></td>
<td><span>{{(bool) config_cache('pixelfed.optimize_video') ? '✅ true' : '❌ false' }}</span></td>
</tr>
<tr>
<td><span class="badge badge-primary">PIXELFED</span></td>
Expand Down

0 comments on commit a72188a

Please sign in to comment.