How to set Image Resolution in uploaded Image in Laravel Intervention

  image, intervention, laravel, php

Please, anyone, help me I want to set the Image Resolution to 300dpi for the uploaded image using Image Intervention.

Any alternate solution is also welcome.

What I want:

Upload Image -> Resize image to (100 X 100) -> Set image size to less than 30KB -> and set image resolution to 300dpi -> auto download

I have done everything else the resolution to my project… Here I’m sending the code and link …

$width = 400;
$height = 200;

$file = $request->file('upload');
$image = Image::make($file)->resize($width, $height)->encode('jpg');

$headers = [
    'Content-Type' => 'image/jpeg',
    'Content-Disposition' => 'attachment; filename=utipanpsa_'.$request->type.'.jpg',
];

return response()->stream(function() use ($image) {
    echo $image;
}, 200, $headers);

https://www.utipanpsa.com/cropping-tools

Source: Laravel

Leave a Reply