PHPackages                             helilabs/laravel-mediable-manipulation - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. helilabs/laravel-mediable-manipulation

Abandoned → [helilabs/laravel-mediable-manipulation](/?search=helilabs%2Flaravel-mediable-manipulation)Library[File &amp; Storage](/categories/file-storage)

helilabs/laravel-mediable-manipulation
======================================

A Laravel Mediable Extension that enables of files manipulation

0261PHP

Since Nov 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mohammedmanssour/laravel-mediable-manipulation)[ Packagist](https://packagist.org/packages/helilabs/laravel-mediable-manipulation)[ RSS](/packages/helilabs-laravel-mediable-manipulation/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Mediable Manipulate Media Extension:
============================================

[](#laravel-mediable-manipulate-media-extension)

This package is an extenstion for the well-known laravel package [Laravel Mediable](https://github.com/plank/laravel-mediable).

The main purpose of this package is to provide comaptible &amp; fast functionalities to manipulate media. **Currently it supports manipulating images only**.

Images Manipulations
--------------------

[](#images-manipulations)

Image Manupulations is being Done via [Intervention\\Image](https://github.com/Intervention/image) package and you can use its methods to manipulate image

use `manipulateImage` function to manipulate images, which take method name as its first arguments and array of method args as its second arguments, for example if you want to resize the image

```
	$media->manipulateImage('resize',['w' => 250, 'h' => 250] )
		->applyImageManipulation()
```

this will generate a new file with the manipulation properties specified, please note that you can apply multiple manipulation properties

```
	$media->manipulateImage('resize',['w' => 250, 'h' => 250] )
		->manipulateImage('colorize', ['Red' => 10, 'Green' => 20, 'Blue' => 30 ] )
		->applyImageManipulation()
```

and if you want to implement two manipulations in a row please make sure to clear Image Manipulations Properties before going to the second one.

```
	//first manipulation resize then colorize then generate
	$media->manipulateImage('resize',['w' => 250, 'h' => 250] )
		->manipulateImage('colorize', ['Red' => 10, 'Green' => 20, 'Blue' => 30 ] )
		->applyImageManipulation();

	//second manipulation resize then colorize then draw a line
	$media
		->clearImageManipulationProperties()
		->manipulateImage('resize',['w' => 250, 'h' => 250] )
		->manipulateImage('colorize', ['Red' => 10, 'Green' => 20, 'Blue' => 30 ] )
		->manipulateImage('line', ['x1' => '0', 'y1' => '0', 'x2' => 20, 'y2' => '20' ] )
		->applyImageManipulation();
```

#### Manipulations Results

[](#manipulations-results)

let's suppose we have media with the follwing attributes

```
	$media->directory = 'foo/bar';
	$media->filename = 'baz';
	$media->filename = 'jpg';
```

if you applied manipulation on this media it won't write on the original file for the sake of keeping the original file, instead it will generate new file with the applied manipulations properties

if you applied `resize` manipulation on media then it will generate new file with the name `foo/bar/baz-resize+250,250.jpg`

if you applied `resize` and `colorize` manipulations on media then it will generate new file with the name `foo/bar/baz-colorize+10,20,30|resize+250,250.jpg`.

Please note that manipulations are sorted alphabetically and added to file names, and if you wondering why because we wanted to avoid implementing manipulation properties on the original file each time you ask for it instead package will search of the corresponding file and if exists package will return it. and if you wonddering why we did that in first place because you know processing/cpus/performance is expensive but storage is not

#### Media Accessers

[](#media-accessers)

Larave Mediable introduces multiple accessers for the media like `getUrl`, `getDiskPath` and `getAbsolutePath` so you can use them to get the manipulated files

```
	$media->manipulateImage('resize',['w' => 250, 'h' => 250] )
		->manipulateImage('colorize', ['Red' => 10, 'Green' => 20, 'Blue' => 30 ] )
		->applyImageManipulation()
		->getUrl()
```

the previous block of code will return a url for the file `foo/bar/baz-colorize+10,20,30|resize+250,250.jpg` relative to media disk

and if you want to get the original files after manipulation you can use `clearImageManipulationProperties` method to clear manipulation properties and get the right file

```
	// this will return foo/bar/baz-colorize+10,20,30|resize+250,250.jpg
	$media->manipulateImage('resize',['w' => 250, 'h' => 250] )
		->manipulateImage('colorize', ['Red' => 10, 'Green' => 20, 'Blue' => 30 ] )
		->applyImageManipulation()
		->getDiskPath();

	// this will return foo/bar/baz-colorize+10,20,30|resize+250,250.jpg
	$media->getDiskPath();

	//this will return foo/bar/baz.jpg
	$media->clearImageManipulationProperties()
			->getDiskPath();
```

#### Move, Rename and Exists

[](#move-rename-and-exists)

if you want to move the original file form one place to another, please note that all of its related files (manipulation results) will be moved too, this will help save space on storage.

use **Laravel Mediable** methods to move and rename.

```
	$media->move( $destination, $newFilename );
	$media->rename($newFilename);
	$media->exists();
```

#### Enabling/Disabling Image Manipulations

[](#enablingdisabling-image-manipulations)

To enable image manipulation use method `enableImageManipulation` like `$media->enableImageManipulation()`, **functionality is enabled be default**

To disable image manipulation use method `disableImageManipulation` like `$media->disableImageManipulation()`.

#### Creating manipulations after media is created

[](#creating-manipulations-after-media-is-created)

You can create manipulations after media is created using the `registerImageManipulations` method, this method should return array of arrays that contains predefined manipulations

```
	//in Your Media Model
	public function registerImageManipulations(){
		return [
			[
				'resize' => ['w' => 250, 'h' => 250]
			],
			[
				'resize' => ['w' => 250, 'h' => 250],
				'colorize' => ['red' => 10, 'green' => 20, 'blue' => 30]
			]
		];
	}
```

now when the model file `created` event it will apply those manipulations on media.

What's next:
------------

[](#whats-next)

Image Manipulation is very important and this is reason why we started with it and stoped here, but we have plans to add **Video Manipulation functionality soon** untill then enjoy and give feedback.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/aeb75f35979097845cce704062910a6a8c85bc0a7b49b081df7350a4f20023fc?d=identicon)[manssour.mohammed](/maintainers/manssour.mohammed)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/helilabs-laravel-mediable-manipulation/health.svg)

```
[![Health](https://phpackages.com/badges/helilabs-laravel-mediable-manipulation/health.svg)](https://phpackages.com/packages/helilabs-laravel-mediable-manipulation)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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