Riwash Chamlagain's avatar

Image Resize crop not work in image Intervention Package In laravel

Hello Friends Image Resize crop not work in dynamic . I try to crop but it does give any result. Path of my image is in uploads folder that folder is in out of public forder in change public path to public_html . here is my code why that package does not give output

if($request->hasFile('image')) {

     $file = $request->file('image');
     $path = public_path().'uploads';
    $extension = '.'.$request->file('image')->extension();
     $filename = 'aamul'.date('ymdhis').$userId.$ranNum.$userId.$extension;
     $file->move($path, $filename);
     $information->image = $filename;
     $img = Image::make(asset('uploads/'.$filename));
  //    $resize = Image::make(asset('uploads/'.$filename))->resize(600, null, function ($constraint) {
  //   $constraint->aspectRatio();
  // })->encode('jpg');
     $img->fit(100, 100, function ($constraint) {
$constraint->upsize();

}); die;

There is not error out put does that package does not found image path? Help me

0 likes
5 replies
munazzil's avatar

Remove die at the end of the code and check it shows the error , have you set debug true in your config under app?

munazzil's avatar

Have you used php artisan storage:link ?

Tray2's avatar

It seems like you move the file before you try to resize it

  $file->move($path, $filename);
  $information->image = $filename;
  $img = Image::make(asset('uploads/'.$filename));

Try changing the order of the statements

  $img = Image::make(asset('uploads/'.$filename));
  $file->move($path, $filename);
  $information->image = $filename;

Please or to participate in this conversation.