Download the PHP package ronpearl/image-compress without Composer

On this page you can find all versions of the php package ronpearl/image-compress. 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-compress

ronpearl/image-compress

Symfony package that will allow you to compress image files using Image Magick

NOTE: This is my first attempt at creating a package for packagist. Please feel free to submit any questions or concerns so I can address them accordingly.

Getting Started

This program requires that you have PHP version 5.6.38 or higher and have Image Magick installed. You would need to confirm this in your phpinfo file, it would be listed under the section called "imagick".

It also assumes that you are using composer and you have a composer.json file already. You can either add this to your require section:

or you can run the composer command to install the package:

and then run:

Usage

Once the package is installed, you can use it within your classes. Add the statement:

This will then allow you to call the Compress class and start using the program. Here is a sample using an image URL:

When creating an instance of the Compress() class, you can pass some variables to customize your compressions. The first variable would be an array of trusted domains (google.com, bing.com, etc...). This way you can limit what domain(s) any compressed image can originate from. The second and third are the compression values based upon Image Magick compression settings. They are based upon images that are either smaller than 800px wide or larger. Both have their own compression values.

Here is a line showing the construction method for Compress():

Once this is set, you can call the doImageCompression() method. This is what allows you to one-by-one compress and receive values back for the final compressed file. The variables are ($originalFileUrlOrPath, $localFile = true, and $getBase64 = false).

$originalFileUrlOrPath is the image URL or the local path to the image.

$localFile defaults to true, but this sets whether the image is from a URL or from a local file.

$getBase64 defaults to false, but you can set it to true if you would like to get the base64 results of the compressed file as well.

Resulting Image(s)

The final images will be saved within your "web" directory under the folder "imageCompress". These folders will be created after your first run of the program. There will be 2 other folders under that: compressed and originals. The originals will temporarily hold the original files, and then the compressed images will be saved into the compressed folder for use later.

Example

Youc an view the example.php file for a raw usage of the package.


All versions of image-compress with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.38
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 ronpearl/image-compress contains the following files

Loading the files please wait ....