PHPackages                             thepublicgood/laravel-image-renderer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. thepublicgood/laravel-image-renderer

ActiveLibrary[Image &amp; Media](/categories/media)

thepublicgood/laravel-image-renderer
====================================

A simple solution for dealing with images in laravel

v0.3.1(4y ago)1814↓80%1MITPHPPHP &gt;7.3CI failing

Since Jun 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/tpg/laravel-image-renderer)[ Packagist](https://packagist.org/packages/thepublicgood/laravel-image-renderer)[ RSS](/packages/thepublicgood-laravel-image-renderer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (4)Versions (9)Used By (0)

> This package has been deprecated as I no longer have any use for it and no longer want to maintain it. You can continue to use the package, but I'd recommend looking at the `intervention/image` package (which this one relies on) as it has URL manipulation built in. There really isn't any need for this package anymore.

Laravel Image Renderer
======================

[](#laravel-image-renderer)

[![Build Status](https://camo.githubusercontent.com/e60df3cb12e67614638289a8a7707f974863205accd50bb1e96a5ba6d8ebb4c9/68747470733a2f2f7472617669732d63692e6f72672f7470672f6c61726176656c2d696d6167652d72656e64657265722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tpg/laravel-image-renderer)

A really simple solution to working with images in Laravel. Especially when using the Artisan `storage:link` command is not an option.

Installation
------------

[](#installation)

Like everything Laravel, the Image Renderer is installed using Composer. From the terminal, in your project root, run:

```
composer require thepublicgood/laravel-image-renderer
```

Once installed, you can publish the config file with:

```
php ./artisan vendor:publish --provider=TPG\ImageRenderer\ImageRendererServiceProvider
```

This will place a `renderer.php` config file in your project `/config` directory. Depending on your project, you may want to update some settings in the config file.

Usage
-----

[](#usage)

A single route will be registered, the default is to use: `/images/{filename}` but this can be changed by altering the `routes.path` key in the config file. You may also wish to alter the `storage` config options. By default, images are expected to be in `/storage/app/images`.

Once an image is stored in the correct location, a GET request to `http://mysite.test/images/filename.jpg` will render the image to the browser. Sub-directories are also supported, so the file `/images/gallery/picture.jpg` can be rendered by pointing to `http://mysite.test/images/gallery/picture.jpg`.

Transformers
------------

[](#transformers)

The Laravel Image Renderer uses the `intervention/image` page to deal with reading and rendering the image. This means that images can be transformed on the fly. Three transformers are included by default: `height`, `width` and `square`. You can scale an image proportionately by passing the transformer name and value as a URL query:

```
http://mysite.test/images/filename.jpg?width=300

```

The `intervention/imagecache` package is also leveraged to cache the transforms so that they're not rerun on each request. To scale an image by it's height, you can use `height=300` or to create a square thumbnail you could use `square=400`.

Transformers can be combined as well.

Custom Transformers
-------------------

[](#custom-transformers)

You can write your own transforms by implementing the `TPG\ImageRenderer\Transformers\Contracts\Transformer` interface. All transformer classes must implement a `handle` method which accept two parameters, and be suffixed with `Transformer`:

```
namespace App\Transformers;

use TPG\ImageRenderer\Transformers\Contracts\Transformer;

class MyTransformer implements Transformer
{
    public function handle($image, array $values)
    {
        $image->crop($values[0], $values[1]);

        return $image;
    }
}
```

The `$image` is an instance of the `Intervention\ImageCache` class and the `$values` array contains any values passed to the query. In the previous example, two values are expected. Remember to return the `$image` when the transformer is complete.

Once the transformer class is in place, the renderer needs to be told that the transformer is available. This can be done in two ways. You can either call the `addTransformer` method on the `ImageRenderer` facade from your `AppServiceProvider`:

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        ImageRenderer::addTransformer(
            'custom',
            App\Transformers\MyTransformer::class
        );
    }
}
```

Or you can add it to the `transformers` config key:

```
return [

    'transformers' => [
        // ...
        'custom' => App\Transformers\MyTransformer::class,
    ]

];
```

You can now use the transformer from the URL:

```
http://mysite.test/images/filename.jpg?custom=300,400

```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please see CONTRIBUTING.md for mre details.

Please make sure to update tests as appropriate.

License
-------

[](#license)

This package is licensed under the [MIT](LICENSE.md) license.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~145 days

Recently: every ~250 days

Total

8

Last Release

1517d ago

PHP version history (2 changes)0.1.0PHP ^7.2.0

v0.3.1PHP &gt;7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/89ea2dc12cd0a934de60705f8cfe47397095d842121b7d5f545dc9d1cee554ec?d=identicon)[warrickbayman](/maintainers/warrickbayman)

---

Top Contributors

[![warrickbayman](https://avatars.githubusercontent.com/u/856840?v=4)](https://github.com/warrickbayman "warrickbayman (3 commits)")[![Rukudzo](https://avatars.githubusercontent.com/u/2829680?v=4)](https://github.com/Rukudzo "Rukudzo (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thepublicgood-laravel-image-renderer/health.svg)

```
[![Health](https://phpackages.com/badges/thepublicgood-laravel-image-renderer/health.svg)](https://phpackages.com/packages/thepublicgood-laravel-image-renderer)
```

###  Alternatives

[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k51.2M116](/packages/league-glide)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[drh2so4/thumbnail

Package for making thumbnails instantly.

5635.3k3](/packages/drh2so4-thumbnail)[danihidayatx/image-optimizer

Optimize your Filament images before they reach your database. Forked from joshembling/image-optimizer for Filament v4 &amp; v5 support.

254.4k](/packages/danihidayatx-image-optimizer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
