Home

Awesome

Laravel Image Handler

Optimize and store images in multiple sizes easily.

Installation steps

composer require codepane/laravel-image-handler
php artisan vendor:publish --provider="Codepane\LaravelImageHandler\ImageHandlerServiceProvider"

Configuration

Usage

Let's deep dive into this package for how to use it

Store Image

use ImageHandler;

public function store()
{
    // its takes the default file name as it is
    ImageHandler::store($request->file);

    // in 2nd argument you can pass your custom file name with or without the path
    ImageHandler::store($request->file, 'file_name_with_or_without_path');
}

Get Image

use ImageHandler;

public function get()
{
    // this will return the original image
    ImageHandler::get('original_file_name');

    // pass dimension as the second argument to get a specific dimension of the file
    ImageHandler::get('original_file_name', 'sm');
}

Get Image Name

use ImageHandler;

public function get()
{
    // pass dimension as the second argument to get a specific dimension of the file name
    ImageHandler::getFileName('original_file_name', 'sm');
}

Delete Image

use ImageHandler;

public function delete()
{
    ImageHandler::delete('original_file_name');
}

Contributing

Contributions are always welcome!