PHPackages                             fpdev/compress\_and\_convert - 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. fpdev/compress\_and\_convert

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

fpdev/compress\_and\_convert
============================

Library to compress and convert images

1.1.1(2y ago)1178MITPHPPHP &gt;=8.1

Since Feb 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Amreal-Lamanera/compress_and_convert_images_library)[ Packagist](https://packagist.org/packages/fpdev/compress_and_convert)[ Docs](https://github.com/Amreal-Lamanera/compress_and_convert_images_library)[ RSS](/packages/fpdev-compress-and-convert/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

Compress And Convert Images Library [![FrancescoPieraccini Logo](./light_blue_nome.svg)](https://www.francescopieraccini.it/)
=============================================================================================================================

[](#compress-and-convert-images-library-)

Hello there! This is my compress and convert library. It is based on the intervention/image package, and its goal is to help users manage images by converting and compressing them.

If you encounter any issues or have questions, feel free to reach out! And don't forget to check out my website at: [Francesco Pieraccini Website](https://www.francescopieraccini.it/)

Installation
------------

[](#installation)

```
composer require fpdev/compress_and_convert

```

Usage
-----

[](#usage)

- Create a `CompressAndConvert` object using the constructor, which requires two mandatory parameters:

    1. `string $extension` - extension to convert
    2. `int $quality` - quality to compress

    Here's an example of how to create it:

    ```
    $obj = new FPDEV\Images\CompressAndConvert(extension: 'webp', quality: 50);
    ```

    This will create an object of `CompressAndConvertImages` that can be used to convert images to webp format and compress them to 50% quality.
- `compressConvertAndSave` function:

    This function requires three mandatory parameters:

    1. `array $fileArray` - \[filename, ext\]
    2. `string $whereToGetFile` - path/to/dir with original files
    3. `string $whereToSaveFile` - path/to/dir where to put output files

    This function utilizes `ImageManager` to convert and compress the file as you set in the constructor. Once completed, the converted and compressed file will be saved in the `$whereToSaveFile` directory and the function returns the compressed file name.
- `getFileExtAllowed` function:

    This is a getter function that returns the allowed file extensions.
- `getFileArraysFromDir` function:

    This function requires one mandatory parameter:

    1. `string $dir` - path/to/dir to scan

    This function scans the `$dir` and returns an array with accepted and discarded files in this format:

    ```
    $acceptedFiles = ['ext', 'filename'];
    $discardedFiles = ['filename'];
    ```
- `zipFiles` function:

    This function requires one mandatory parameter:

    1. `string $dirWithFiles` - path/to/dir with files to zip

    This function creates a zip file containing all the images in `$dirWithFiles`. The zip file will be saved in the same directory.
- `removeFilesFromDir` function:

    This function requires one mandatory parameter:

    1. `string $dir` - path/to/dir

    This function deletes all the files in `$dir` except zip files and .gitkeep file. Call this function if you want to clean the output from all compressed images but maintain the zip file.
- `filenameToFileArray` function:

    This function requires one mandatory parameter:

    1. `string $filename` - a filename

    This function returns a fileArray that can be used in the `compressConvertAndSave` function, derived from the given filename. The fileArray has the format: `[filename, ext]`

### License

[](#license)

This library is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.7% 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 ~2 days

Total

3

Last Release

873d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/857451f26f60c72d84ea5e57442cfccc4bbb5c505f813a22c886b729b82e18e8?d=identicon)[Amreal-Lamanera](/maintainers/Amreal-Lamanera)

---

Top Contributors

[![Amreal-Lamanera](https://avatars.githubusercontent.com/u/13675401?v=4)](https://github.com/Amreal-Lamanera "Amreal-Lamanera (15 commits)")[![francesco-pieraccini](https://avatars.githubusercontent.com/u/125678358?v=4)](https://github.com/francesco-pieraccini "francesco-pieraccini (11 commits)")

---

Tags

convertcompressimages

### Embed Badge

![Health badge](/badges/fpdev-compress-and-convert/health.svg)

```
[![Health](https://phpackages.com/badges/fpdev-compress-and-convert/health.svg)](https://phpackages.com/packages/fpdev-compress-and-convert)
```

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1588.9M181](/packages/intervention-image-laravel)[intervention/image-driver-vips

libvips driver for Intervention Image

48177.4k11](/packages/intervention-image-driver-vips)[danihidayatx/image-optimizer

Optimize your Filament images before they reach your database. Forked from joshembling/image-optimizer for Filament v4 &amp; v5 support.

3218.1k](/packages/danihidayatx-image-optimizer)[tihiy-production/php-image-compressor

ImageCompressor - this is an easy way to compress images on the fly

244.1k](/packages/tihiy-production-php-image-compressor)[ayvazyan10/nova-imagic

Imagic is a Laravel Nova field package that allows for image manipulation capabilities, such as cropping, resizing, quality adjustment, and WebP conversion. It utilizes the powerful Intervention Image class for image manipulation.

144.5k1](/packages/ayvazyan10-nova-imagic)

PHPackages © 2026

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