Download the PHP package popphp/pop-image without Composer

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

pop-image

Build Status Coverage Status

Join the chat at https://popphp.slack.com Join the chat at https://discord.gg/TZjgT74U7E

Overview

pop-image is a powerful and robust image processing component that's simple to use. It supports the GD and Imagick extensions. The API is similar to the more popular image editing application on the market, with calls to editing objects that can be extended with additional image processing functionality if needed.

pop-image is a component of the Pop PHP Framework.

Top

Install

Install pop-image using Composer.

composer require popphp/pop-image

Or, require it in your composer.json file

"require": {
    "popphp/pop-image" : "^4.0.0"
}

Top

Quickstart

Resizing an image

Crop the image

Crop the image to a square thumbnail

Top

Load an Image

There are a couple of ways to load an image into an image adapter:

Load from a file on disk:

Load from a stream of content:

Top

Create an Image

There are a couple of ways to create a new image and load it into an image adapter:

Create an RGB-based image

Create an index-based image

Top

Convert an Image

You can simply convert an image to another format by calling the convert() method:

NOTE: the GD adapter is limited to JPG, PNG and GIF formats. The Imagick adapter can work with a large number of formats, depending on your environment. The Imagick section in the phpinfo() result screen will display the list of formats available for Imagick in your environment.

Top

Output an Image

Once you have an image adapter and have finished editing the image, you have two options to output the image.

Save to disk

Use the writeToFile() method and pass it a filename and an optional image quality parameter:

Output to HTTP

Use the outputToHttp() method to send the image content directly an HTTP client like a browser:

This method has several optional parameters to assist with the delivery over HTTP:

Top

Destroy an Image

Destroying an image will clear the image contents from memory to assist with memory management and prevent possibly exceeding any memory limits when working with a large number of files.

If you wish to clear the current image file from disk, you can pass a true boolean to the method:

Top

Image Adapters

The two image adapters available are GD and Imagick and they share a basic core API:

Top

GD

To work with the GD adapter, you can load it from the main image class in a few different ways:

Top

Imagick

To work with the Imagick adapter, you can load it from the main image class in a few different ways:

The Imagick adapter API extends the functionality with additional Imagick-specific methods:

Top

Advanced Editing

Using the editing objects

There are 6 available editing objects for advanced editing and adjusting of images:

Examples

Here are some example use cases:

Top

CAPTCHA

The pop-image component comes with a CAPTCHA tool to create a CAPTCHA image and store the token value in session to validate the user's CAPTCHA input.

The script above will generate the following image:

And with it, the $_SESSION variable will store a pop_captcha key with a serialized value in it. When you unserialized the $_SESSION['pop_captcha'] value, it will give you this array:

You can use the captcha value to display the image in an HTML page and the answer value to validate the user's CAPTCHA input.

Top


All versions of pop-image with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
popphp/pop-color Version ^1.0.0
ext-gd Version *
ext-imagick Version *
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 popphp/pop-image contains the following files

Loading the files please wait ....