Download the PHP package sandstorm/laravel-imagor without Composer

On this page you can find all versions of the php package sandstorm/laravel-imagor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-imagor

Laravel integration for Imagor

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A comprehensive Laravel package for Imagor integration. Generate optimized, signed image URLs with fluent API including resizing, quality control, visual effects, and advanced processing options. Originally forked from https://github.com/imsus/laravel-imgproxy, which deserves most credit :)

Features

Installation

You can install the package via composer:

You can publish the config file with:

To set up Imagor via docker-compose.yaml, use the following snippet:

Finally, can call the URL /__imagor-configtest to check if Imagor is configured correctly. This example copies some pre-defined images to the storage folder and then loads it through Imagor to check if everything is wired correctly.

Setup Details of the Docker setup:
> if you want to build the image yourself, see see the [./laravel-imagor](./laravel-imagor) folder which contains the sources > of this docker image. Mount the `./storage` folder of your Laravel application to the same folder in the Imagor container; so if the storage folder is located at `/app/storage`, you should mount it to `/app/storage` in the Imagor container as well. Then, you can use `FILE_LOADER_BASE_DIR='/app'` to load images from the mounted storage folder. Adjust the path mapping if needed via the `path_map` config option:

Basic Usage

NOTE: the image URL to be processed is passed at the END of the chain, to be able to use the same instance of the Imagor class for multiple image processing operations:

NOTE: the Imagor class is immutable, so you always need to assign the result of a method call to a variable:

Accessing the Imagor object

The following methods exist for accessing the Imagor object:

If in doubt, use one of the injections.

Resizing & Cropping

Quality & Format Control

Visual Effects

Image Transformations

Accessing the image binary data

If, for some reason, you need to access the image binary data, you can use ->imageBinaryDataFor() instead of ->uriFor():

Laravel Integration

Livewire: Display temporary uploaded files

before:

after:

Display images from the public storage

before:

after:

TODO: see if we can make this work a bit simpler :)

Upload images in Filament Forms

before:

after:

Blade Directives

Create custom Blade directives for common use cases:

API Reference

Available Methods

Method Parameters Description
resize(int $width, int $height) Width, height in pixels Set image dimensions
crop(int $a, int $b, int $c, int $d) Coordinates Manual crop (left, top, right, bottom)
fitIn() - Fit image within dimensions
stretch() - Force resize without aspect ratio
smart() - Smart focal point detection
trim() - Remove surrounding whitespace
flipHorizontally() - Flip image horizontally
flipVertically() - Flip image vertically
padding(int $left, int $top, int $right, int $bottom) Padding values Add padding around image
hAlign(string $align) 'left', 'right', 'center' Horizontal alignment
vAlign(string $align) 'top', 'bottom', 'middle' Vertical alignment
quality(int $quality) 0-100 Set JPEG quality
format(string $format) Format string Set output format
blur(float $sigma) โ‰ฅ0.0 Apply blur effect
sharpen(float $sigma) โ‰ฅ0.0 Apply sharpen effect
brightness(int $amount) -255 to 255 Adjust brightness
contrast(int $amount) Percentage Adjust contrast
saturation(int $amount) Percentage Adjust saturation
addFilter(string $name, ...$args) Filter name and args Add custom filter
uriFor(string $sourceImage) Image URL Generate final URL

Supported Formats

Image Processing Recipes

Photo Enhancement

E-commerce Optimization

Development Setup

Unit & Integration Tests

Interactive Testing with Workbench

The package includes a comprehensive workbench environment for interactive testing:

Now access the Visual Test Suite at http://localhost:8000/imgproxy-visual-test

Troubleshooting

Problem: Getting "unsafe" URLs instead of signed URLs

Solution: Ensure IMAGOR_SECRET is set in your .env file.

Problem: Images not loading/404 errors Solutions:

Problem: Poor image quality
Solutions:

File Sizes

imagor_docker, with VIPS_MOZJPEG: 0; or shumc/imagor:latest

(no mozjpeg)

imagor_docker, with VIPS_MOZJPEG: 1

f.e. the image ghcr.io/cshum/imagor-mozjpeg:docker-variants from https://github.com/cshum/imagor/issues/456#issuecomment-3341418493

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-imagor with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.19
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sandstorm/laravel-imagor contains the following files

Loading the files please wait ...