Download the PHP package danihidayatx/image-optimizer without Composer

On this page you can find all versions of the php package danihidayatx/image-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package image-optimizer

This package is a fork of joshembling/image-optimizer, updated to support Filament v4 & v5 and Laravel 12 & 13.

Optimize your Filament images before they reach your database.

Downloads Latest Version on Packagist

When you currently upload an image using the native Filament component FileUpload, the original file is saved without any compression or conversion.

Additionally, if you upload an image and use conversions with SpatieMediaLibraryFileUpload, the original file is saved with its corresponding versions provided on your model.

What if you'd rather convert and reduce the image(s) before reaching your database/S3 bucket? Especially in the case where you know you'll never need to save the original image sizes the user has uploaded.

🤳 This is where Filament Image Optimizer comes in.

You use the same components as you have been doing and have access to two additional methods for maximum optimization, saving you a lot of disk space in the process. 🎉

Contents

Installation

You can install the package via composer, which works with Filament v3.x, v4.x & v5.x, and Laravel 10, 11, 12 & 13:

Usage

Filament version

You must be using Filament v3.x, v4.x or v5.x to have access to this plugin.

PHP Laravel version Filament version Image Optimizer version
^8.2 ^10.0, ^11.0, ^12.0, ^13.0 ^3.2, ^4.0, ^5.0 ^2.2

Server

GD Library must be installed on your server to compress images.

To ensure WebP images are previewed correctly in the admin panel, you may need to add the correct mime types to your server configuration.

Apache Users (.htaccess):

Nginx Users:

Ensure your mime.types file includes:

Optimizing images

Before uploading your image, you may choose to optimize it by converting to your chosen format. The file saved to your disk will be the converted version only.

E.g. I want to convert my image to 'webp':

`

You can do exactly the same using SpatieMediaLibraryFileUpload:

`

This also works with SpatieMediaLibraryFileUpload:

`

Uploaded image size is 640px x 360px.

You can do the same using SpatieMediaLibraryFileUpload:

`

Combining methods

You can combine these two methods for maximum optimization.

[!TIP] Most methods like resize(), maxImageWidth(), and maxImageHeight() also support Closures, allowing you to dynamically adjust settings based on form state.

`

Multiple images

You can also do this with multiple images - all images will be converted to the same format and reduced with the same percentage passed in. Just chain on multiple() to your upload:

`

Examples

Debugging

PHPStan / Static Analysis

Since the methods (optimize(), resize(), etc.) are registered at runtime using Laravel macros, PHPStan / Larastan might flag them as undefined methods.

This package ships with a PHPStan extension to automatically declare these methods.

A. Automatic (Recommended)

If your project uses phpstan/extension-installer, the extension will be discovered and loaded automatically. No additional configuration is required.

B. Manual

If you do not use the extension installer, you must manually register the extension in your project's phpstan.neon (or phpstan.neon.dist) file:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of image-optimizer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/forms Version ^3.0|^4.0|^5.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
intervention/image Version ^2.7|^3.0
spatie/laravel-package-tools Version ^1.19.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package danihidayatx/image-optimizer contains the following files

Loading the files please wait ...