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 11mo 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 1mo ago

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 64% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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

828d 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

[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6038.1M54](/packages/rosell-dk-webp-convert)[h4cc/wkhtmltoimage-amd64

Convert html to image using webkit (qtwebkit). Static linked linux binary for amd64 systems.

20110.7M15](/packages/h4cc-wkhtmltoimage-amd64)[andrewgjohnson/imagettftextblur

imagettftextblur is a drop in replacement for imagettftext with added parameters to add blur, glow and shadow effects to your PHP GD images

27198.4k1](/packages/andrewgjohnson-imagettftextblur)[tihiy-production/php-image-compressor

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

243.8k](/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.3k1](/packages/ayvazyan10-nova-imagic)

PHPackages © 2026

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