Download the PHP package glaivepro/image without Composer
On this page you can find all versions of the php package glaivepro/image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download glaivepro/image
More information about glaivepro/image
Files in glaivepro/image
Package image
Short Description Image manipulation via URLs for Laravel
License MIT
Homepage https://github.com/glaivepro/image
Informations about the package image
Image
Image manipulation via URLs for Laravel. It provides a URL interface, while the manipulations themselves are done by Intervention.
The manipulated files are stored at the requested URL so the manipulation won't be repeated, but the file will directly be served by your web server.
This package is heavily inspired by folklore/image.
Installation
Currently this package does not publish any config, but the manipulations are done by intervention. In case you need to change the driver to imagick, you should configure intervention.
Usage
Let us consider an image that's publicly accessible as example.com/img/some.jpg.
This package will let you get a downsized and cropped version of this file via
the URL example.com/img/some-image(120x150).jpg. The manipulated image will
be stored in the img directory as some-image(120x150).jpg so that the next
request to example.com/img/some-image(120x150).jpg will be handled by your
web server providing the stored file.
If you want to downsize, but keep the aspect ratio, skip one of the dimensions:
example.com/img/some-image(200x_).jpg— constrain widthexample.com/img/some-image(_x90).jpg— constrain height
Few other manipulations are available as well:
example.com/img/some-image(blur).jpgexample.com/img/some-image(blur(10)).jpgexample.com/img/some-image(pixelate(12)).jpgexample.com/img/some-image(resize(120,140)).jpg— resizing without croppingexample.com/img/some-image(100x200-pixelate(10)).jpgexample.com/img/some-image(resize(120,140)-blur-pixelate(12)).jpg
Generating URLs
The simple (size constraining) URIs can be generated via our facade:
Note The method is named
urlfor compatibility withfolklore/image. Even though this is not intended as a drop-in replacement, this case will be such if you redefineImagefacade alias to point toGlaivePro\Image\GPImage.
Full URLs can be generated via the asset method:
More complex URIs can be generated using the stringable Uri class:
Instances of Uri can also be produced by the url and asset methods
of the GPImage facade:
Custom filters
You can register your own filters that will receive the intervention instance and any arguments which you can then handle as needed: