PHPackages                             melsaka/laravel-image-manager - 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. melsaka/laravel-image-manager

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

melsaka/laravel-image-manager
=============================

A Laravel package for managing polymorphic images with automatic resizing and storage management

v2.0.0(3mo ago)2101MITPHPPHP ^8.1|^8.2|^8.3

Since Aug 19Pushed 3mo agoCompare

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

READMEChangelog (2)Dependencies (5)Versions (3)Used By (1)

Laravel Image Manager Package
=============================

[](#laravel-image-manager-package)

A comprehensive Laravel package for managing polymorphic images with automatic resizing, multiple formats support, and flexible storage options.

Features
--------

[](#features)

- **Polymorphic Image Relations**: Associate images with any Eloquent model
- **Automatic Image Resizing**: Configure multiple sizes for different use cases
- **Format Conversion**: Convert images to WebP, JPEG, PNG, or keep original format
- **Flexible Storage**: Support for any Laravel filesystem disk
- **Batch Operations**: Store, update, sync, and delete multiple images
- **Easy Configuration**: Simple configuration for different models and image types

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

[](#installation)

Install the package via Composer:

```
composer require melsaka/laravel-image-manager
```

Publish the configuration file:

```
php artisan vendor:publish --tag=image-manager-config
```

Publish the migration file: (optional)

```
php artisan vendor:publish --tag=image-manager-migrations
```

Run the migration:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

The configuration file `config/image-manager.php` allows you to customize:

- Storage disk and base path
- Default image format and quality
- Model-specific image types and sizes
- Public/private access settings

### Example Configuration

[](#example-configuration)

```
return [
    'storage_disk' => 'public', // could be r2, aws, etc..
    'base_path' => 'uploads',
    'format' => 'webp',
    'quality' => 90,
];
```

Important: Storage Link
-----------------------

[](#important-storage-link)

If you're using the `public` disk (default), don't forget to create the storage link:

```
php artisan storage:link
```

This creates a symbolic link from `public/storage` to `storage/app/public`, making your images accessible via URL.

Usage
-----

[](#usage)

### 1. Add the Trait to Your Model

[](#1-add-the-trait-to-your-model)

```
