Lectures List
capscom technology computer course almora

Laravel intervention image open source package

With laravel livewire

composer require intervention/image

At config/app.php add provider and alias

Intervention\Image\ImageServiceProvider::class
'Image' => Intervention\Image\Facades\Image::class

Livewire code

<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Livewire\WithFileUploads;
use Image;
class ImageTest extends Component
{
     use WithFileUploads;
    public $image;
    
    public function render()
    {
        return view('livewire.image-test')->extends('templates.public_layout');
    }
    public function upload(){
        $this->validate([
            'image' => 'image|max:3000', // 1MB Max
        ]);
       $path = $this->image->store("temp","public");
        
        Image::make($this->image)
        ->resize(100, null, function ($constraint) {
                $constraint->aspectRatio();
            })
        ->save(storage_path()."/app/public/raw/first.jpg");
    }
}
 
Author/Written by: Mr Hemant Singh (Founder)
Terms & Conditions CAPSCOM TECHNOLOGY Pvt. Ltd. का बेहतर रूप से संचालन करने के लिए यहॉ कुछ नियमें और शर्ते लागू है अगर आप कैप्सकॉम टैक्नोलॉजी में पढ़ रहे है तो यह आप पर लागू होता है।