laravel width and high storage

1

What would be the code to know the width and height of an image in a directory?

I was currently doing it with getimagesize() but I wanted to know if it could be done with storage of laravel .

Something like:

Storage::size('file1.jpg');// este es para saber el tamaño

eye : I'm not uploading an image, I want to know the width and height of an image that I already have saved.
I hope you can help me. Any idea that helps solve my problem will be well received.
Thanks.

    
asked by Abel291 05.08.2017 в 03:45
source

1 answer

0

You could use Intervention / image which is very useful for image processing.

Installation

You run from your console composer require intervention/image

Laravel integration

You add your Service Provider : Intervention\Image\ImageServiceProvider::class and your Facades : 'Image' => Intervention\Image\Facades\Image::class are both in the file located in config / app.php .

Later you can already use it.

Getting the width

$width = Image::make('public/foo.jpg')->width();

Getting the high

$height = Image::make('public/foo.jpg')->height();

  

Note : Both functions return an integer

You will also find many useful functions when managing images in your project

    
answered by 05.08.2017 / 13:28
source