PHPackages                             falmar/eimage - 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. falmar/eimage

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

falmar/eimage
=============

Image upload, resize and crop PHP Class

v0.0.1-alpha(10y ago)252MITPHPPHP &gt;=5.4

Since Apr 5Pushed 6y ago4 watchersCompare

[ Source](https://github.com/falmar/eImage)[ Packagist](https://packagist.org/packages/falmar/eimage)[ RSS](/packages/falmar-eimage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

eImage - Image upload, resize and crop!
=======================================

[](#eimage---image-upload-resize-and-crop)

[![Build Status](https://camo.githubusercontent.com/fb08b5b3b99b5e55d6432ce0640f8d5ce57fb695a3e629d7a87a56fb094400a1/68747470733a2f2f7472617669732d63692e6f72672f66616c6d61722f65496d6167652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/falmar/eImage)

eImage it's a simple PHP Class to make Uploading and Editing Images even more easy!

A rewrite of a old Class (\_image) originally written by Mark Jackson (mjdigital) all credits of main idea goes to him :D

Major changes from the original class:

- Used all available PSR (Autoload, CodeStyle, etc...)
- Added Exception to handle errors
- Reduced portions of code by putting them into general class methods
- Removed obsolete|unused methods|conditions|variables

Requirements
------------

[](#requirements)

- PHP &gt;= 5.4

Examples
--------

[](#examples)

### Upload Image

[](#upload-image)

```
use eImage\eImage;
use eImage\eImageException;

/** Upload your image **/
$File = (isset($_FILES['img'])) ? $_FILES['img'] : null;

require_once('eImage/autoload.php');

try {

  /**
   * Simple Upload
   */
  $Image = new eImage();
  $Image->upload($File);

  /** -------------------------------------------------- */

  /**
   * The next code will do the following:
   * Rename the image to my_new_image.
   * Place the uploaded image into base_dir/Images/
   * Create a new unique image if find an existing one.
   * return an array with the new image properties.
   */
  $Image = new eImage([
      'NewName'    => 'my_new_name',
      'UploadTo'   => 'Images/',
      'Duplicates' => 'u',
      'ReturnType' => 'array'
  ]);
  $Image->upload($File);

} catch (eImageException $e){
  /** do something **/
}
```

> NOTE: If there is not an extension specified in 'NewName' parameter it will take the extension from the original image. NOTE2: You can specify a new extension with NewExtension property

### Crop Image

[](#crop-image)

```
use eImage\eImage;
use eImage\eImageException;

/** Upload your image **/
$File = (isset($_FILES['img'])) ? $_FILES['img'] : null;

require_once('eImage/autoload.php');

try {

   /**
    * Crop from upload
    */
   $Image = new eImage();
   $Image->upload($File);
   $Image->crop(250, 250, -50, -75);

   /** -------------------------------------------------- */

   /**
    * Crop from source file
    */
   $Image->set([
       'Source' => 'path_to_your_file.jpg',
       'Prefix' => 'AfterCrop-'
   ]);
   $Image->crop(250, 250, -50, -75);

} catch (eImageException $e){
  /** do something **/
}
```

> NOTE: if you do not specify a NewName or Prefix parameter the original image will be override by the new crop method. You can also set the Duplicates to 'u' unique to create a new image instead of override

### Resize Image

[](#resize-image)

```
use eImage\eImage;
use eImage\eImageException;

/** Upload your image **/
$File = (isset($_FILES['img'])) ? $_FILES['img'] : null;

require_once('eImage/autoload.php');

try {

   /**
    * Resize from upload
    */
   $Image = new eImage();
   $Image->upload($File);
   $Image->resize(600, 450);

   /** -------------------------------------------------- */

   /**
    * Resize from source file
    */
   $Image->set([
       'Source' => 'my_source_image.jpg',
       'Prefix' => 'AfterResize-',
       'AspectRatio' => false,
       'ScaleUp' => true
   ]);
   $Image->resize(600, 205);

} catch (eImageException $e){
  /** do something **/
}
```

> NOTE: You may want to specify resize properties such as AspectRatio, Oversize, ScaleUp according to your needs.

### Parameters and their default values

[](#parameters-and-their-default-values)

```
public $NewName;

public $UploadTo;

public $ReturnType = 'full_path';

public $SafeRename = true;

public $Duplicates = 'o';

private $EnableMIMEs = [
    '.jpe'  => 'image/jpeg',
    '.jpg'  => 'image/jpg',
    '.jpeg' => 'image/jpeg',
    '.gif'  => 'image/gif',
    '.png'  => 'image/png',
    '.bmp'  => 'image/bmp',
    '.ico'  => 'image/x-icon',
];
private $DisabledMIMEs = [];

public $CreateDir = false;

public $Source;

public $ImageQuality = 90;

public $NewExtension;

public $Prefix;

public $NewPath;

public $AspectRatio = true;

public $Oversize = false;

public $ScaleUp = false;

public $Position = 'cc';

public $FitPad = true;

public $PadColor = 'transparent';
```

#### NewName

[](#newname)

Specify the new name for your image.

#### UploadTo

[](#uploadto)

Specify where the new image is going to be uploaded to.

#### ReturnType

[](#returntype)

- 'full\_path': string with the full path to the new image.
- 'bool': true or false if the upload succeeded.
- 'array':
    - from upload() method: Pretty close to the `$_FILE` array it will return name, path, size, tmp\_name and full\_path.
    - from crop() method: Will return name, prefix, path, height, width and full\_path.
    - from resize() method: Will return name, prefix, path, height, width, pad\_color and full\_path.

#### SafeRename

[](#saferename)

- true: will clean the image name and remove strange characters.
- false: the new image will contain the same name as the uploaded image.

#### Duplicates

[](#duplicates)

If a there is an existing file:

- 'o': Overwrite the file.
- 'u': Create an unique file.
- 'e': Throw eImageException.

#### EnabledMIMEs

[](#enabledmimes)

An array that contain the MIME Types the eImage Class will be allow to upload.

```
['.jpg' => 'image/jpg']
```

#### DisabledMIMEs

[](#disabledmimes)

If this property is set with values it will forbid to upload the MIME Types or Extensions specified.

> NOTE: Any other MIME Type or Extension THAT IS NOT SET HERE will be allowed to upload.

#### Source

[](#source)

Full path to a file automatically set after image upload for easy access resize and crop methods.

#### CreateDir

[](#createdir)

If set to true create a directory if not exist (UploadTo | NewPath).

#### ImageQuality

[](#imagequality)

Integer \[1-100\]%.

#### NewExtension

[](#newextension)

Apply a new extension to the image (.jpg, .png, .gif).

#### Prefix

[](#prefix)

Specify a new prefix for the image.

#### NewPath

[](#newpath)

Specify path for the new image, it apply only for crop() and resize() methods.

#### AspectRatio

[](#aspectratio)

Set true or false if you want to maintain or not your image aspect ratio.

#### Oversize

[](#oversize)

If true it will oversize the image when width &gt; height or the otherwise.

#### ScaleUp

[](#scaleup)

Set true if want allow the image to scale up from a small size to a bigger one.

#### PadColor

[](#padcolor)

Hexadecimal color string for the image background if does not fit the canvas, default is 'transparent'.

#### FitPad

[](#fitpad)

Set true if want to make use of the Position to fit the image in the canvas when the new size does not fit and AspectRatio is true.

#### Position

[](#position)

Set the position of source in the canvas:

- 'tr': top right
- 'tl': top left
- 'tc': top center
- 'br': bottom right
- 'bl': bottom left
- 'bc': bottom center
- 'cr': center right
- 'cl': center left
- 'cc': center horizontal and vertically

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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

Unknown

Total

1

Last Release

3686d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/640f1d3c25533cc63ae4a9c115ea720d15eaabe86238ee84eb5e632ca5fad544?d=identicon)[falmar](/maintainers/falmar)

---

Top Contributors

[![falmar](https://avatars.githubusercontent.com/u/12632471?v=4)](https://github.com/falmar "falmar (33 commits)")

---

Tags

image-processingphp

### Embed Badge

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

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)[marc1706/fast-image-size

fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.

959.4M20](/packages/marc1706-fast-image-size)[char0n/ffmpeg-php

PHP wrapper for FFmpeg application

495225.1k1](/packages/char0n-ffmpeg-php)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)

PHPackages © 2026

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