PHPackages                             geofftech/laravel-imagestyle - 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. geofftech/laravel-imagestyle

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

geofftech/laravel-imagestyle
============================

2.3.2(1y ago)13151MITPHPPHP \*

Since Apr 21Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/geofftech/laravel-imagestyle)[ Packagist](https://packagist.org/packages/geofftech/laravel-imagestyle)[ RSS](/packages/geofftech-laravel-imagestyle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (17)Used By (1)

GeoffTech Laravel Image Styles
==============================

[](#geofftech-laravel-image-styles)

- resizes and stores images such as thumbnails or the original
- resized images are stored in a dedicated 'cache' disk to separate from real data
- works by generating a URL to a resized file
- if that URL is viewed, it initially hits a route which generates and saves that resized image
- this uses the concept that real files will always be served before the routes are processed

Agent Instructions
------------------

[](#agent-instructions)

This Laravel package provides image resizing and caching functionality. When working with this codebase:

### Key Components

[](#key-components)

- **ImageStyle.php**: Main class that handles image processing and URL generation
- **ImageStyleController.php**: Controller that handles dynamic image generation requests
- **ServiceProvider.php**: Registers the package services and routes
- **helpers.php**: Contains the `img()` helper function for easy access
- **Commands**: Clean and purge commands for cache management

### Helper Function Usage

[](#helper-function-usage)

Use the `img()` helper function to generate image style URLs:

```
// Basic usage
img($imagePath)->thumbnail()
img($imagePath)->resize(300, 200)

// In Eloquent models
public function thumbnailUrl(): Attribute
{
    return Attribute::make(
        get: fn () => img($this->image)->thumbnail()
    );
}
```

### Configuration

[](#configuration)

- Configuration file: `config/imagestyle.php`
- Cache disk must be configured in `config/filesystems.php`
- Routes are automatically registered via the ServiceProvider

### Image Processing Flow

[](#image-processing-flow)

1. Helper function generates URL pointing to cache location
2. If cached file doesn't exist, route intercepts request
3. Controller processes original image and saves to cache
4. Subsequent requests serve the cached file directly

### Development Notes

[](#development-notes)

- Uses Intervention Image v3 for image processing
- Requires properly configured cache disk and storage links
- Images are stored in `/storage/app/cache` and served from `/cache` URL

Uses Intervention Images
------------------------

[](#uses-intervention-images)

-

Sample Attribute
----------------

[](#sample-attribute)

```
    public function thumbnailUrl(): Attribute
    {
        return Attribute::make(
            get: fn () => img($this->image)->thumbnail()
        );
    }
```

Setup
-----

[](#setup)

### 1. Setup Cache Disk

[](#1-setup-cache-disk)

- create and link a new local disk
- edit `/config/filesystem.php`
- add a cache disk

```
    'disks' => [

        ...

        'cache' => [
            'driver' => 'local',
            'root' => storage_path('app/cache'),
            'url' => env('APP_URL') . '/cache',
            'visibility' => 'public',
            'throw' => false,
        ],
    ],
```

### 2. Add a Storage link entry

[](#2-add-a-storage-link-entry)

```
    'links' => [
        public_path('storage') => storage_path('app/public'),
        public_path('cache') => storage_path('app/cache'),
    ],
```

### 3. Run Storage Link

[](#3-run-storage-link)

```
a storage:link
```

- now files in the `/storage/app/cache` folder are accessible from the `/cache` folder in the domain name

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance58

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~24 days

Recently: every ~60 days

Total

16

Last Release

392d ago

Major Versions

1.0.2 → 2.0.02024-08-10

PHP version history (2 changes)1.0.0PHP ^8.2

2.3.2PHP \*

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b0d954edec5a17aa7fc4c71357660f60ea2af580999125bc121ea135d21ee7a?d=identicon)[geofftech](/maintainers/geofftech)

---

Top Contributors

[![geofftech](https://avatars.githubusercontent.com/u/390920?v=4)](https://github.com/geofftech "geofftech (27 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/geofftech-laravel-imagestyle/health.svg)

```
[![Health](https://phpackages.com/badges/geofftech-laravel-imagestyle/health.svg)](https://phpackages.com/packages/geofftech-laravel-imagestyle)
```

###  Alternatives

[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M100](/packages/intervention-image-laravel)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[devfactory/imagecache

Laravel package for generating thumbnails of images and caching them in your public files folder.

1620.3k](/packages/devfactory-imagecache)

PHPackages © 2026

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