Download the PHP package darrynten/pslayers without Composer

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

pslayers

Travis Build Status StyleCI Status codecov Packagist Version MIT License

Powerful and fully featured PHP library that features photoshop-style image layering, compositing, filtering, blending and masking.

Uses Imagick and PHP 7+

Introduction

We needed to give buzzbot.ai a way to express herself visually, so we gave her photoshop-level image management and manipulation capabilities.

This is the core package that our bots use during their Generation phases. As such it has been designed from the ground up to be simple to use, but to also allow for maximum flexibility.

The core function of this package is to provide an easy way to layer images and then composite them together.

We're pre-releasing this as it does everything we need it to, but we're busy with other stuff, and as you know incomplete and released is better (and quicker) than complete and released. And we need it on packagist :)

Basic Usage

Single Layer

Standard base getters and setters

It was very silly to do var/get/set all with the same name. This is on the todo list to refactor out.

Getting details of the layer

All layer classes implement an interface which forces the method getLayerDetailsArray() which returns an array representation of the layer, which differs from layer to layer.

There is a helper method that fetches the JSON representation of this which is called getLayerDetailsJson() and all types of layers have this method available on them.

Setting the Composite

Composite is the Composite Operator Constants, which is Imagick integer constants.

You pass then in with Imagick::COMPOSITE_DEFAULT or whichever composite operator you want to apply on your layer.

Currently only 1 composite, it is not possible to combine composites yet.

This composite will be applied when the stack is rendered.

Collections of Layers

Programmatic Collections

You can make and manipulate your own collections if you like

Rendering

You can call the render method on your collection which will render up from index 0

Layer Types

More info on the standard layer types

Blank Layer

Detailed above, this is the most basic but most powerful of layers. It has unlimited potential.

You can interact with its canvas attribute, which is a fully functional Imagick class.

Go crazy!

Text Layer

Allows addition and manipulation of text

Adds some additional text-specific properties

Image Layer

This only works with the imageUrl config option at this time.

You can still set the image directly or use a BlankLayer and set your image on that canvas.

This will be fixed.

Gradient Layer

Currently only a start-to-finish top-to-bottom solid-to-solid gradient layer. This will be expanded upon.

There is no start or end or direction yet

Radial Gradient Layer

Like its cousin it's also not 100% implemented, but it provides the most basic of radial gradient that Imagick has to offer.

Solid Layer

This is just a solid colour layer

Pattern Layer

A layer that tiles a standard Imagick pattern. You can add optional scaling and scale filtering values.

This is not a tiling layer, this uses standard, low res, built in patterns that come with Imagick.

Plasma Layer

Generates the standard Imagick plasma: style Psuedoimage.

Group Layer

This is basically a layer that contains another collection of layers that can each have their own compositing trees, so you can have greater control over your layer composition and manipulation.

This needs to get its render triggered when appropriate

Compositing

A big part of the power of this comes from the compositing that is available.

You can add a composite mode to any layer and during render it will be applied.

Note that while you can apply multiple filters to layers, you can only apply a single composite. If you want to achieve multiple composite mixes at once you can achieve this by making a group layer with copies of the same layer in there and composite each copy the way you want.

Supported composite modes

TODO before v1 release

Exaxt PS Layer Blend Modes for Reference

Darken

Lighten

Contrast

Inversion

Cancelleation

Component

Mask

NOT IMPLEMENTED

Filters

There is support for filters

You can combine filters on a layer in a similar way to how you combine layers together in a collection - the z-index is the array index, and the render is run up the index.

Standard Filters

These are the base filters included with pslayers.

We have designed them to be easily extensible and creatable, and will happily accept new filters into the core library should they be up to scratch. Contributions are welcome.

Blur

Basic blur filter

Fred's Filters Filter Pack

We've included this by default, but you need to ask Fred if you're wanting to use them for anything other than personal use.

These are wrapped up versions of the infamous Fred's Imagick scripts that have been implemented as safely and securely as we possibly could.

In order to keep things consistent we do not support any default values with any of these filters.

We have not implemented all the filters, but there is a solid base there that should make it easy for anyone to quickly add one of his filters.

This also means that you can wrap up any bash script you like, but please, use this wisely. We will only accept any contributions along these lines after careful vetting.

Implemented Fred Filter and Usage

Stained Glass

Gives a stained glass effect.

Docs

Dice

Dices up the images

Docs

Other Freds Filters

Not all filters have been added. If you add a filter please do contribute it back to this project via a PR.

You can extend FredBaseFilter and follow the style within one of the other templates.

As an example we will run through the creation of the stained glass filter - you can follow along in the source for this filter.

The usage instructions show the switches

You will use those in the creation of the class.

At the very least you need the following

although you will see in the file that there is very strict validation happening in all of these classes, but we will not be worrying about that right now for the sake of this tutorial.

Next we set the extend the included base filter and set the command.

This is the command that one would run if using these filters in the command line.

We then make a mapping of all the switches

These will get mapped out to the command when the render() method that is inside the base class is called.

You will notice that there is no support for the -a switch, as it operates sort-of like a boolean, but we have not added this type of "anonymous" switch (a switch that does not provide a value).

Please feel free to update the base filter to support this.

We then make protected variables for each entry in the switch map that will be used by the base class when constructing.

Every single one of these must be the exact name as per the switch map you defined above. This is very important. It is also important that you map to the short version of the switch.

Then you make a constructor

And then you're done. That's the entirety of creating a mapping to one of the filters. All the magic happens in the base fred filter :)

Remember though, we have not included any validation or doc blocks in the above example, which must be included for a new filter to be accepted into the project. It is also important to throw exceptions for any validation errors (don't return false, you must throw).

Acknowledgements


All versions of pslayers with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
guzzlehttp/guzzle Version ^6.2.1
darrynten/any-cache Version ^1.0
symfony/process Version ^4.1
darrynten/imagick-scripts Version ~1.0.1
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 darrynten/pslayers contains the following files

Loading the files please wait ....