Update Laravel to v12 #30
83 changed files with 1404 additions and 2403 deletions
commit
1dfa17abca
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
Loading…
Reference in a new issue