Compare commits

...
Author SHA1 Message Date
07db68882b Merge pull request 'MTM Laravel v12' (#31) from develop into main
Some checks failed
Deploy / Deploy (release) Has been cancelled
Reviewed-on: #31
2025-04-04 18:10:46 +02:00
1dfa17abca
Update Laravel to v12
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
2025-04-01 21:10:30 +01:00
f2025b801b
Update dependencies
Some checks failed
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
2025-01-25 11:47:43 +00:00
4e7b911fe9
Improve commentt in script
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
2025-01-25 11:20:37 +00:00
cf6e65cc03
Improve compress script
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
Generate zst and br files, then  remove any that are actually larger
than the source file
2024-12-28 11:07:48 +00:00
101 changed files with 2134 additions and 2938 deletions

View file

@ -12,7 +12,9 @@ APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
@ -39,7 +41,7 @@ FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
@ -49,6 +51,7 @@ REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null

View file

@ -32,18 +32,21 @@ class ProcessMedia implements ShouldQueue
*/
public function handle(ImageManager $manager): void
{
// Load file
$file = Storage::disk('local')->get('media/' . $this->filename);
// Open file
try {
$image = $manager->read(storage_path('app/media/') . $this->filename);
$image = $manager->read($file);
} catch (DecoderException) {
// not an image; delete file and end job
unlink(storage_path('app/media/') . $this->filename);
Storage::disk('local')->delete('media/' . $this->filename);
return;
}
// Save the file publicly
Storage::disk('local')->copy('media/' . $this->filename, 'public/media/' . $this->filename);
Storage::disk('public')->put('media/' . $this->filename, $file);
// Create smaller versions if necessary
if ($image->width() > 1000) {
@ -54,13 +57,13 @@ class ProcessMedia implements ShouldQueue
$basename = trim(implode('.', $filenameParts), '.');
$medium = $image->resize(width: 1000);
Storage::disk('local')->put('public/media/' . $basename . '-medium.' . $extension, (string) $medium->encode());
Storage::disk('public')->put('media/' . $basename . '-medium.' . $extension, (string) $medium->encode());
$small = $image->resize(width: 500);
Storage::disk('local')->put('public/media/' . $basename . '-small.' . $extension, (string) $small->encode());
Storage::disk('public')->put('media/' . $basename . '-small.' . $extension, (string) $small->encode());
}
// Now we can delete the locally saved image
unlink(storage_path('app/media/') . $this->filename);
Storage::disk('local')->delete('media/' . $this->filename);
}
}

Some files were not shown because too many files have changed in this diff Show more