PHPackages                             softrang/image-helper - 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. softrang/image-helper

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

softrang/image-helper
=====================

A simple image upload, update, and delete helper for Laravel and PHP.

v1.0.6(7mo ago)018MITPHPPHP ^8.2

Since Oct 15Pushed 7mo agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (8)Used By (0)

Laravel Image Upload, Update &amp; Delete Helper (by Softrang)
--------------------------------------------------------------

[](#laravel-image-upload-update--delete-helper-by-softrang)

```
A simple and developer-friendly helper for image upload, update, and delete in Laravel 12+, created by [Softrang](https://softrang.com).

```

- Upload images with optional resize (width &amp; height)
- Update images (automatically deletes old image)
- Delete images safely from the public folder
- Optimize image quality and size (target 15–30 KB)
- Support for JPEG, PNG, GIF, WebP formats

1️⃣ Install via Composer
------------------------

[](#1️⃣-install-via-composer)

```
composer require softrang/image-helper
```

2️⃣ Upload Image
----------------

[](#2️⃣-upload-image)

##### Upload an image with optional width and height. The function automatically resizes and optimizes the image.

[](#upload-an-image-with-optional-width-and-height-the-function-automatically-resizes-and-optimizes-the-image)

```
$path = upload_image($request->file('image'), 'products', [
    'width' => 300,  // Optional: Resize width
    'height' => 300, // Optional: Resize height
]);

// Save path to your database
Product::create([
    'name' => $request->name,
    'image' => $path
]);
```

3️⃣ Update Image
----------------

[](#3️⃣-update-image)

##### Update an image. This function automatically deletes the old image from the public folder and uploads the new one with optional resize.

[](#update-an-image-this-function-automatically-deletes-the-old-image-from-the-public-folder-and-uploads-the-new-one-with-optional-resize)

```
$path = update_image($request->file('image'), $request->old_image, 'products', [
    'width' => 300,  // Optional: Resize width
    'height' => 300, // Optional: Resize height
]);

// Update your database with new path
$product->update([
    'image' => $path
]);
```

4️⃣ Delete Image
----------------

[](#4️⃣-delete-image)

```
$image = $request->image; // Get image path from database
delete_image($image);
```

5️⃣ Supported Image Formats
---------------------------

[](#5️⃣-supported-image-formats)

- jpg / jpeg
- png (supports transparency)
- gif
- webp (supports transparency)

6️⃣ Features
------------

[](#6️⃣-features)

- ✅ Resize Images with optional width &amp; height
- ✅ Quality Optimization to keep images between 15–30 KB
- ✅ Transparency Support for PNG &amp; WebP
- ✅ Auto Delete Old Image on update
- ✅ Easy to Integrate in Laravel 12+ projects
- ✅ Standalone: No external packages required

7️⃣ Example Controller
----------------------

[](#7️⃣-example-controller)

```
file('image'), 'products', [
            'width' => 300,
            'height' => 300
        ]);

        return response()->json(['uploaded' => $path]);
    }

    public function update(Request $request)
    {
        $path = update_image($request->file('image'), $request->old_image, 'products', [
            'width' => 300,
            'height' => 300
        ]);

        return response()->json(['updated' => $path]);
    }

    public function destroy(Request $request)
    {
        delete_image($request->image);

        return response()->json(['deleted' => true]);
    }
}
```

8️⃣ Notes
---------

[](#8️⃣-notes)

- Automatically creates directories if they don’t exist
- Optimized for performance and small file size
- Easy to customize allowed file types

9️⃣ License
-----------

[](#9️⃣-license)

```
MIT License – free to use, modify, and distribute.

```

1️⃣0️⃣ How to Display the Image
-------------------------------

[](#1️⃣0️⃣-how-to-display-the-image)

#### After storing the image path in your database, you can display it in Blade like this:

[](#after-storing-the-image-path-in-your-database-you-can-display-it-in-blade-like-this)

```
@php
    $image = $request->image; // or from your database column
@endphp

```

Note:
-----

[](#note)

- If your images are stored inside `public/uploads`, and your database stores `'uploads/filename.jpg'`, then `asset($image)` will generate the correct URL.
- If your images are stored inside subdirectories of `public/uploads` (like `public/uploads/subfolder/filename.jpg`), and your database does not store the full path, then `asset($image)` may not generate the correct URL.
- Do **not** prepend `'uploads/'` again if your database path already contains it.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance64

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

7

Last Release

215d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e67d49e6c18bf156c75f8c2a1c4a0c51018bc3c0a1568f89cffc6b016228dd6?d=identicon)[softrang](/maintainers/softrang)

---

Top Contributors

[![softrang](https://avatars.githubusercontent.com/u/152640876?v=4)](https://github.com/softrang "softrang (2 commits)")

### Embed Badge

![Health badge](/badges/softrang-image-helper/health.svg)

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

###  Alternatives

[creativeorange/gravatar

A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.

5467.5M54](/packages/creativeorange-gravatar)[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)[ralphjsmit/laravel-glide

Auto-magically generate responsive images from static image files.

4719.6k5](/packages/ralphjsmit-laravel-glide)[spatie/laravel-og-image

Generate OG images for your Laravel app

305.2k](/packages/spatie-laravel-og-image)[nikkanetiya/laravel-color-palette

Laravel Wrapper for `ksubileau/color-thief-php`. Grabs the dominant color or a representative color palette from an image. Uses PHP and GD or Imagick.

3312.6k](/packages/nikkanetiya-laravel-color-palette)

PHPackages © 2026

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