Download the PHP package gregwar/image without Composer

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

Gregwar's Image class

Build status paypal

The Gregwar\Image class purpose is to provide a simple object-oriented images handling and caching API.

Installation

With composer :

Usage

Basic handling

Using methods chaining, you can open, transform and save a file in a single line:

Here are the resize methods:

The other methods available are:

You can also create image from scratch using:

Where 200 is the width and 100 the height

Saving the image

You can save the image to an explicit file using save($file, $type = 'jpg', $quality = 80):

You can also get the contents of the image using get($type = 'jpg', $quality = 80), which will return the binary contents of the image

Using cache

Each operation above is not actually applied on the opened image, but added in an operations array. This operation array, the name, type and modification time of file are hashed using sha1() and the hash is used to look up for a cache file.

Once the cache directory configured, you can call the following methods:

For instance:

If the original file and operations do not change, the hashed value will be the same and the cache will not be generated again.

You can use this directly in an HTML document:

This is powerful since if you change the original image or any of your code the cached hash will change and the file will be regenerated.

Writing image

You can also create your own image on-the-fly using drawing functions:

Using fallback image

If the image file doesn't exist, you can configure a fallback image that will be used by the class (note that this requires the cache directory to be available).

A default "error" image which is used is in images/error.jpg, you can change it with:

Garbage Collect

To prevent the cache from growing forever, you can use the provided GarbageCollect class as below:

Development

Gregwar\Image is using PHP metaprogramming paradigms that makes it easy to enhance.

Each function that handles the image is implemented in an Adapter, this is where all the specific actions take place.

The Common adapter is design to contain common abstract actions, while the specific adapters (like GD) are designed to contain actions specific to the low level layer.

You can add your own methods by adding it in the corresponding adapter.

Which could be used on the Image

You can also write your own adapter which could extend one of this repository and use it by calling setAdapter():

License

Gregwar\Image is under MIT License, please read the LICENSE file for further details. Do not hesitate to fork this repository and customize it !


All versions of image with dependencies

PHP Build Version
Package Version
Requires ext-gd Version *
gregwar/cache Version ^1.0.6
php Version ^5.6 || ^7.0 || ^8.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 gregwar/image contains the following files

Loading the files please wait ....