PHPackages                             eihror/compress-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. eihror/compress-image

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

eihror/compress-image
=====================

Compress your image without losing quality

v0.0.6(7y ago)347.3k↓36.7%18[3 issues](https://github.com/eihror/compress-image/issues)2MITPHPPHP &gt;=5.3.0

Since Nov 12Pushed 7y ago4 watchersCompare

[ Source](https://github.com/eihror/compress-image)[ Packagist](https://packagist.org/packages/eihror/compress-image)[ Docs](https://github.com/eihror/compress-image)[ RSS](/packages/eihror-compress-image/feed)WikiDiscussions v0.0.6 Synced yesterday

READMEChangelog (5)DependenciesVersions (10)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/fbeb66087b2a07edc5f679127f1e798ae5ee6cfff868e291dfa6b8a9ad455b67/68747470733a2f2f706f7365722e707567782e6f72672f656968726f722f636f6d70726573732d696d6167652f762f737461626c65)](https://packagist.org/packages/eihror/compress-image)[![Total Downloads](https://camo.githubusercontent.com/7eb1d2e784683d2df86c7476fd107b88520add64c77d38ae7f20bc3596f981c4/68747470733a2f2f706f7365722e707567782e6f72672f656968726f722f636f6d70726573732d696d6167652f646f776e6c6f616473)](https://packagist.org/packages/eihror/compress-image)[![Latest Unstable Version](https://camo.githubusercontent.com/596166c90fcc8233fd7b8e052711a94cc9d8f08176c1fddef27923a776801d3b/68747470733a2f2f706f7365722e707567782e6f72672f656968726f722f636f6d70726573732d696d6167652f762f756e737461626c65)](https://packagist.org/packages/eihror/compress-image)[![License](https://camo.githubusercontent.com/069fbfa3e2359dcf7358067047dfbd497e04aa1249ba0773890b59823135c981/68747470733a2f2f706f7365722e707567782e6f72672f656968726f722f636f6d70726573732d696d6167652f6c6963656e7365)](https://packagist.org/packages/eihror/compress-image)

Compress Image
==============

[](#compress-image)

Compress your image without losing quality

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

[](#how-to-use)

Clone this project inside the project that you want to use

```
composer require eihror/compress-image

```

Create variables to receive the elements

```
$file = 'koala.jpg'; //file that you wanna compress
$new_name_image = 'koala_mini'; //name of new file compressed
$quality = 60; // Value that I chose
$pngQuality = 9; // Exclusive for PNG files
$destination = 'content'; //This destination must be exist on your project
$maxsize = 5245330; //Set maximum image size in bytes. if no value given 5mb by default.

```

**The quality works only for JPG�s images. But if you want to change the file to PNG�s, you have to change manually via code. GIF doesn't affect the quality**

Default quality for PNG: **9 ( 0 - no compression, 9 - max compression )**Create a new instance of a class

```
$image_compress = new Eihror\Compress\Compress($file, $new_name_image, $quality, $pngQuality, $destination, $maxsize);

```

And make the compression calling the function **compress\_image**

```
$image_compress->compress_image();

```

This function will return only the name of new image compressed with your respective extension

That´s it! Feel free to use and making the code better if you find something different or wrong

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.4% 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 ~119 days

Recently: every ~81 days

Total

9

Last Release

2568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b90fa6640ecea827e3c16d82f478f00e4d6ae96bd02b270b4cacb4d48ed85f7?d=identicon)[eihror](/maintainers/eihror)

---

Top Contributors

[![eihror](https://avatars.githubusercontent.com/u/5113532?v=4)](https://github.com/eihror "eihror (38 commits)")[![AjithLalps](https://avatars.githubusercontent.com/u/18158025?v=4)](https://github.com/AjithLalps "AjithLalps (3 commits)")[![adaamz](https://avatars.githubusercontent.com/u/4347332?v=4)](https://github.com/adaamz "adaamz (1 commits)")[![bardcrack](https://avatars.githubusercontent.com/u/8503160?v=4)](https://github.com/bardcrack "bardcrack (1 commits)")

### Embed Badge

![Health badge](/badges/eihror-compress-image/health.svg)

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

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