mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Implemented Commands/resizeImages
This commit is contained in:
parent
d8b9795ddc
commit
917aea2f2d
1 changed files with 12 additions and 1 deletions
|
@ -3,6 +3,8 @@
|
|||
namespace Poniverse\Ponyfm\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Poniverse\Ponyfm\Models\Image;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
class ResizeImages extends Command
|
||||
{
|
||||
|
@ -33,10 +35,19 @@ class ResizeImages extends Command
|
|||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$images = Image::all();
|
||||
foreach ($images as $image) {
|
||||
$this->info("Regenerating images for ".$image->filename);
|
||||
$image->clearExisting();
|
||||
|
||||
$originalFile = new File($image->getFile(Image::ORIGINAL));
|
||||
foreach (Image::$ImageTypes as $imageType) {
|
||||
Image::processFile($originalFile, $image->getFile($imageType['id']), $imageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue