Download the PHP package antonlukin/poster-editor without Composer

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

Poster Editor

This class is an alternative to the package Intervention Image for more flexible work with text on the image. Use it if you need to fit text in a given area, automatically calculate font size and change line height. The text drawing method also knows how to return the actual size of the inscriptions, which will allow, for example, to place blocks under each other.

In addition to flexible work with text, the class provides an Image API similar to the Intervention package. Including smart poster resizing, filters, drawing shapes, and overlaying other images.

If you are not using composer in your work, you may also be interested in the simplicity of the class and the absence of any dependencies. Note that this class supports PHP-GD driver only. You can also easily inherit your class — all methods of the parent can be overridden.

Installation

The best way to install Poster Editor is quickly and easily with Composer.
However, you can require the class directly without using a loader - this will not affect performance in any way.

php composer.phar require antonlukin/poster-editor

Usage

In case of an error, the class methods return an exception.
Therefore, it is best to call them inside a block try..catch.

Example

Availible methods

get

Get image resource to use raw gd commands.

set

Set image resource after using raw gd commands.

make

Make new image instance from file or binary data.

insert

Paste a given image source over the current image with an optional position. First param can be binary data or path to file or another class instance. Options is an array of x/y relative offset coords from top left corner and opacity from 0 to 100, where 0 is no transparency. By default image will be centered.

canvas

Intialise the canvas by width and height. Background color options is in array of color/opacity settings. By default black canvas without opacity.

show

Sends HTTP response with current image in given format and quality. Format is a file image extension. By default the response data will be encoded in the type of the current image. If no image type is defined yet, method will return jpeg encoded data. Quality is normalized for all file types to a range from 0 (poor quality, small file) to 100 (best quality, big file). The default value is 90. PNG format is losless and the quality affects only image size and compression speed.

save

Save the current state of the image object in filesystem. Define optionally a certain path where the image should be saved. The image type will be defined by file extension. If there is no extension available, the response data will be encoded in the type of the current image. If no image type is defined yet, method will return jpeg encoded data. Optionally you can override this with the format parameter. Quality is normalized for all file types to a range from 0 (poor quality, small file) to 100 (best quality, big file). The default value is 90. PNG format is losless and the quality affects only image size and compression speed.

destroy

Frees memory associated with the current image instance before the PHP script ends. Normally resources are destroyed automatically after the script is finished.

width

Returns the height in pixels of the current image.

height

Returns the height in pixels of the current image.

resize

Resizes current image based on given width and height. Does not pay attention to the aspect ratio. In order to resize proportionally, use upsize and downsize methods.

upsize

Upsize image on the largest side. Calculated by ratio for nulled width or height.

downsize

Downsize image on the largest side. Calculated by ratio for nulled width or height.

crop

Cut out a rectangular part of the current image with given width and height. Define optional x,y coordinates to move the top-left corner of the cutout to a certain position.

fit

Combine cropping and resizing to format image in a smart way. The method will find the best fitting aspect ratio on the current image automatically, cut it out and resize it to the given dimension. Possible positions top-left, top, top-right, bottom-left, bottom, bottom-right, right, left and center by default.

line

Draw a line from x,y point 1 to x,y point 2 on current image. Use options param to set color, opacity and width values.

rectangle

Draw a colored rectangle on current image. Use options param to set color, opacity, thickness and outline values.

ellipse

Draw an ellipse. Use options param to set color, opacity and outline values.

brightness

Change the brightness of the current image by the given level. Use values between -100 for min brightness 0 for no change and +100 for max.

contrast

Change the contrast of the current image by the given level. Use values between -100 for min contrast 0 for no change and +100 for max.

grayscale

Turn an image into a grayscale version.

blur

Apply a blur image effect.

invert

Invert colors of an image.

blackout

Draw black opactity rectangle on image.

rotate

Rotate image. Set an angle in degrees and optional color of the uncovered zone after the rotation.

text

Draw text on image. Possible options:

Use boundary to get actual dimensions of the drawn text box. See detailed examples below.

Examples

Append downsized image to blackout background

Result

Draw and center multiline text

Result

Draw and justify multiline text

Result

Use boundaries to draw one title right after another

Result

Draw shapes

Result

Contribution

All project code is stored on Github. The best way to help the project is to report a bug or add some new functionality. You can also open here an issue or send a pull reguest.


All versions of poster-editor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.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 antonlukin/poster-editor contains the following files

Loading the files please wait ....