PHPackages                             program-2/image - 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. program-2/image

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

program-2/image
===============

Image is a library for uploading images

0.1.2(7y ago)110Apache-2.0PHPPHP &gt;=5.5

Since May 2Pushed 7y agoCompare

[ Source](https://github.com/program-2/image)[ Packagist](https://packagist.org/packages/program-2/image)[ RSS](/packages/program-2-image/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Image is a library for uploading images
---------------------------------------

[](#image---is-a-library-for-uploading-images)

\\

Introduction
------------

[](#introduction)

This minimal PHP library is my attempt to upload images safely by an object oriented approach.

It's 79 lines.

Aims
----

[](#aims)

1- to provide safe uploading.

2- to be fully in an object oriented approach.

3- to have ability to define image name and image extension (to saved with),

also maxSize, imageTypes, errorMassage.

How to use it
-------------

[](#how-to-use-it)

#### Parameters

[](#parameters)

This is the main method of Image:

```
save($name, $directory, $file)

```

**$name**

- Is the name that html form assigns to the uploaded image.

**$directory**

- Is the destination directory that the image will be saved in.
- This should be an already existing directory on server.

**$file**

- Is the name and extention that you choose for the new uploaded file like personel.png .
- This third parameter can be omitted from the save() method.
- If no $file value is provided, the client's uploaded name and extension will be used.

#### Return value

[](#return-value)

- class returns TRUE on success.
- class returns FALSE on failure.

#### Image type and size configurations (by State Design Pattern)

[](#image-type-and-size-configurations-by-state-design-pattern)

- After instantiating the Image class and before using the save() method you can

allocate values of $maxSize :int (IN BYTES) and $alowedTypes :array (of extensions only),

not feeding them means accepting all sizes and all image types.

#### errorMessage3

[](#errormessage3)

- Get and directly show the error message any where with using the errorMessage() method of the same object.
- It returns NULL on a successful image saving.

#### A Complete Example:

[](#a-complete-example)

\\

```
$obj = new Image  //-> or any other way like dependency injection

$obj -> maxSize = 4900000;

$obj -> allowedTypes = ['png', 'jpg', 'jpeg'];

$obj -> save('image','pics/lastfolder','personel.png');

echo ($obj -> errorMessage());

```

\\

Credit
------

[](#credit)

Developed by Ehsan Yousefi  \[\]

Updates
-------

[](#updates)

"20/4/2019 first release version 0.0.0"

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

2571d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49523862?v=4)[Ehsan Yousefi](/maintainers/program-2)[@program-2](https://github.com/program-2)

---

Top Contributors

[![program-2](https://avatars.githubusercontent.com/u/49523862?v=4)](https://github.com/program-2 "program-2 (8 commits)")

---

Tags

imagelibrary

### Embed Badge

![Health badge](/badges/program-2-image/health.svg)

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

###  Alternatives

[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

860918.1k11](/packages/sybio-image-workshop)[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

141110.4k6](/packages/stefangabos-zebra-image)

PHPackages © 2026

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