PHPackages                             codeawn/image\_compress - 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. codeawn/image\_compress

ActiveLibrary[File &amp; Storage](/categories/file-storage)

codeawn/image\_compress
=======================

Compress image with callback support

3.0.0(8y ago)12.1kmitPHPPHP &gt;=5.3.0

Since Aug 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/codeawn/image_compress)[ Packagist](https://packagist.org/packages/codeawn/image_compress)[ Docs](https://github.com/codeawn)[ RSS](/packages/codeawn-image-compress/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

```
composer require codeawn/image_compress

```

Compress from file upload form
==============================

[](#compress-from-file-upload-form)

```
\Codeawn\image::uploadCompress($input, $args, $quality, $unlink);
```

- **$input** : (string) input file name attribute, use \[\] for multiple file e.g `attribute[]`
- **$args** : destination folder include `/` e.g `upload/` or `callback function`
- **$quality** : (int) quality of compressed images
- **$unlink** : (booelan) remove file source

Compress from string or array
=============================

[](#compress-from--string-or--array)

```
\Codeawn\image::imageCompress($input, $args, $quality, $unlink);
```

- **$input** : file name include path or array e.g `["folder/file1.jpg","folder/file2.jpg"]`to process multiple file

Example
=======

[](#example)

**HTML**

```

```

**PHP**

```
if(isset($_POST['upload'])) {

    try{ if(\Codeawn\image::uploadCompress(
        "gambar", function ($file,$name) {
            // backup original files
            copy($file, "backup/".$name);
            // show current progress
            echo"processing : ".$name."";
            // build new name based date & time
            $date = date("Ymd_his");
            $fname = $date."_".$name;
            // replace space with underscore
            $fname = str_replace(" ","_",$fname);
            // since compressed using imagejpeg function so rename non .jpg extension to .jpg
            $fname = preg_replace('/\.(png|jpeg|gif)$/', '.jpg', $fname);
            // return string filename with path
            return "uploaded/".$fname;
            // return false; for cancel process
        }, 80, true
        )===false){
        throw new \Codeawn\FailException("upload failed","bad request!");
        } else{

        // this will show when no exception
        echo"Success ";
    }
    }
    catch(Codeawn\FailException $e) { echo $e->getTitle()," ",$e->getMessage();
    }
} else{ echo"waiting upload ..";
}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~3 days

Total

3

Last Release

3187d ago

Major Versions

1.0.0 → 2.0.02017-08-17

2.0.0 → 3.0.02017-08-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/b95613d83c0582664ebb9de5e8000e7eaf66f4cced4dbde55e1ce68b601fad9d?d=identicon)[codeawn](/maintainers/codeawn)

---

Top Contributors

[![codeawn](https://avatars.githubusercontent.com/u/29153983?v=4)](https://github.com/codeawn "codeawn (6 commits)")

---

Tags

imagegdcompressioncompressimagesupload

### Embed Badge

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

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

###  Alternatives

[kartik-v/bootstrap-fileinput

An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.

5.4k7.9M13](/packages/kartik-v-bootstrap-fileinput)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[verot/class.upload.php

This PHP class uploads files and manipulates images very easily.

881909.5k15](/packages/verot-classuploadphp)[sopamo/laravel-filepond

Laravel backend module for filepond uploads

215272.2k3](/packages/sopamo-laravel-filepond)[fof/upload

The file upload extension for the Flarum forum with insane intelligence.

188171.7k15](/packages/fof-upload)[mohorev/yii2-upload-behavior

Upload behavior for Yii 2

128265.5k9](/packages/mohorev-yii2-upload-behavior)

PHPackages © 2026

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