Skip to content

Commit

Permalink
Resize images to full hd
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecraank committed Mar 13, 2024
1 parent 5da84d7 commit 50f1393
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/Console/Commands/PresentationProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
use App\Models\Presentation;
use App\Models\Slide;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;


class PresentationProcess extends Command
{
/**
Expand Down Expand Up @@ -55,10 +53,16 @@ public function processPdf($presentation)
for ($i = 1; $i <= $pages; $i++) {
$random = Str::random(7);
$imagename = $random . '-' . $i . '.jpg';
$pdf->setResolution(300);

$pdf->setPage($i)->saveImage(public_path('data/presentations/' . $presentation->id . '/' . $imagename));
$pdf->setResolution(25);
$resizeImage = \Intervention\Image\Facades\Image::make(public_path('data/presentations/' . $presentation->id . '/' . $imagename))
->resize(1920, 1080)
->save(public_path('data/presentations/' . $presentation->id . '/' . $imagename));

$pdf->setPage($i)->saveImage(public_path('data/presentations/' . $presentation->id . '/preview-' . $imagename));
$resizeImage = \Intervention\Image\Facades\Image::make(public_path('data/presentations/' . $presentation->id . '/preview-' . $imagename))
->resize(1920, 1080)
->save(public_path('data/presentations/' . $presentation->id . '/preview-' . $imagename));

Slide::updateOrCreate([
'presentation_id' => $presentation->id,
Expand Down

0 comments on commit 50f1393

Please sign in to comment.