PHPackages                             imagemaker/imagemaker - 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. imagemaker/imagemaker

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

imagemaker/imagemaker
=====================

A Laravel package for image upload, retrieval, resizing, placeholder generation, and thumbnail management.

1.0.1(1y ago)011MITPHP

Since Oct 27Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

ImageMaker Package
==================

[](#imagemaker-package)

The **ImageMaker** package provides a convenient way to handle image uploads, resizing, thumbnail creation, and generating placeholder images in your Laravel application. It abstracts the complexities of image handling, making it easy to integrate image functionality into your projects.

Features
--------

[](#features)

- **Image Uploading**: Easily upload images to the specified storage disk.
- **Image Resizing**: Resize images to specific dimensions upon upload.
- **Thumbnail Creation**: Automatically generate thumbnails for images.
- **Old Image Removal**: Optionally remove old images when new ones are uploaded.
- **Image Retrieval**: Retrieve image URLs with fallback to a placeholder if the image is not found.
- **Placeholder Generation**: Create placeholder images with specified dimensions and custom background colors.
- **Configurable Storage Disk**: Set the storage disk used for saving images during instantiation.

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

[](#installation)

To install the `ImageMaker` package, include it in your `composer.json` file or run:

```
composer require imagemaker/imagemaker

## Usage

### Basic Setup

To use the `ImageMaker` package, first, ensure you have it installed. Then, instantiate the `ImageMaker` class, specifying the desired storage disk:

```php
use ImageMaker\ImageMaker;

// Instantiate the ImageMaker class with the desired disk (default is 'public')
$imageMaker = new ImageMaker('public');

## Methods

### 1. `__construct($disk = 'public')`

#### Description
Initializes a new instance of the `ImageMaker` class.

#### Parameters
- **`$disk`** *(string, optional)*: The name of the storage disk to use. Defaults to `'public'`.

---

### 2. `uploadImage($file, $path, $size = null, $thumb = null, $old = null)`

#### Description
Uploads an image to the specified path, optionally resizing it and creating a thumbnail. It also removes an old image if specified.

#### Parameters
- **`$file`** *(\Illuminate\Http\UploadedFile)*: The uploaded file instance.
- **`$path`** *(string)*: The directory path where the image will be stored.
- **`$size`** *(string|null, optional)*: The size to which the image should be resized (format: `widthxheight`).
- **`$thumb`** *(string|null, optional)*: The size for the thumbnail (format: `widthxheight`).
- **`$old`** *(string|null, optional)*: The filename of the old image to be removed.

#### Returns
- **string**: The filename of the uploaded image.

#### Throws
- **Exception**: If the uploaded file is invalid or not an image.

---

### 3. `getImage($path, $filename, $size = '100x100', $thumb = false)`

#### Description
Retrieves the URL of the uploaded image. If the image is not found, it can return a placeholder or a thumbnail if specified.

#### Parameters
- **`$path`** *(string)*: The directory path where the image is stored.
- **`$filename`** *(string)*: The name of the uploaded image file.
- **`$size`** *(string, optional)*: The size for the fallback placeholder image (format: `widthxheight`). Defaults to `'100x100'`.
- **`$thumb`** *(bool, optional)*: A boolean to specify whether to return the thumbnail if available. Defaults to `false`.

#### Returns
- **string**: The URL of the uploaded image or placeholder image.

---

### 4. `generatePlaceholderImage($width, $height, $color = [200, 200, 200])`

#### Description
Generates a placeholder image with specified dimensions and an optional background color.

#### Parameters
- **`$width`** *(int)*: The width of the placeholder image.
- **`$height`** *(int)*: The height of the placeholder image.
- **`$color`** *(array, optional)*: An array representing the RGB values for the background color. Defaults to `[200, 200, 200]`.

#### Returns
- **string**: The URL of the generated placeholder image.

#### Throws
- **Exception**: If the font file required for text rendering is not found.

---

### 5. `removeOldImage($path, $filename)`

#### Description
Removes the old image from storage if it exists, along with its thumbnail.

#### Parameters
- **`$path`** *(string)*: The directory path where the image is stored.
- **`$filename`** *(string)*: The name of the old image file to be removed.

#### Returns
- **bool**: Returns `true` if the image was successfully removed, `false` if the file was not found.

---

### 6. `ensureDirectoryExists($path)`

#### Description
Ensures that the specified directory exists for storing images. If the directory does not exist, it creates it.

#### Parameters
- **`$path`** *(string)*: The directory path to check or create.

#### Returns
- **void**

---

### 7. `isImage($file)`

#### Description
Validates if the uploaded file is an image based on its MIME type.

#### Parameters
- **`$file`** *(\Illuminate\Http\UploadedFile)*: The uploaded file instance.

#### Returns
- **bool**: Returns `true` if the file is a valid image type, otherwise `false`.

---

### 8. `resizeImage($filePath, $size)`

#### Description
Resizes the image to the specified dimensions.

#### Parameters
- **`$filePath`** *(string)*: The full file path of the image to be resized.
- **`$size`** *(string)*: The size to which the image should be resized (format: `widthxheight`).

#### Returns
- **void**

---

### 9. `createThumbnail($filePath, $thumb, $path, $filename)`

#### Description
Creates a thumbnail of the uploaded image at the specified dimensions.

#### Parameters
- **`$filePath`** *(string)*: The full file path of the original image.
- **`$thumb`** *(string)*: The size for the thumbnail (format: `widthxheight`).
- **`$path`** *(string)*: The directory path where the thumbnail will be stored.
- **`$filename`** *(string)*: The name of the original uploaded file.

#### Returns
- **void**

---

This structure gives users a clear understanding of each method's purpose, parameters, and return values, making it easier for them to integrate and use the `ImageMaker` package effectively.

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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 ~0 days

Total

2

Last Release

568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/752f1c22f61343fbb398fb315373652f266b3d80085310952a68ea9fbc89de0d?d=identicon)[rirakib](/maintainers/rirakib)

---

Top Contributors

[![rirakib](https://avatars.githubusercontent.com/u/83156839?v=4)](https://github.com/rirakib "rirakib (5 commits)")

---

Tags

laravelthumbnailimage processingplaceholderImage uploadresize imageimagemaker

### Embed Badge

![Health badge](/badges/imagemaker-imagemaker/health.svg)

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

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1536.5M102](/packages/intervention-image-laravel)[sadovojav/yii2-image-thumbnail

Yii2 image thumbnail component

2142.1k](/packages/sadovojav-yii2-image-thumbnail)

PHPackages © 2026

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