Download the PHP package yellowskies/imagine-bundle without Composer

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

Deprecated

This project is no longer actively maintained, please find one of the populate forks. Thanks!

SkiesImagineBundle

This bundle provides easy image manipulation support for Symfony2. For example, with this bundle, the following is possible:

`

This will perform the transformation called thumbnail, which you can define to do a number of different things, such as resizing, cropping, drawing, masking, etc.

This bundle integrates the standalone PHP "Imagine library".

Installation

Installation is a quick 3 step process:

  1. Download SkiesImagineBundle using composer
  2. Enable the Bundle
  3. Configure your application's config.yml

Step 1: Download SkiesImagineBundle using composer

Add SkiesImagineBundle in your composer.json:

Composer will install the bundle to your project's vendor/Skies/imagine-bundle directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

Step3: Register the bundle's routes

Finally, add the following to your routing file:

Congratulations! You're ready to rock your images!

Basic Usage

This bundle works by configuring a set of filters and then applying those filters to images inside a template. So, start by creating some sort of filter that you need to apply somewhere in your application. For example, suppose you want to thumbnail an image to a size of 120x90 pixels:

You can also change the quality and the format you want to use to save our image :

You've now defined a filter called my_thumb that performs a thumbnail transformation. We'll learn more about available transformations later, but for now, this new filter can be used immediately in a template:

Or if you're using PHP templates:

Behind the scenes, the bundle applies the filter(s) to the image on the first request and then caches the image to a similar path. On the next request, the cached image would be served directly from the file system.

In this example, the final rendered path would be something like /media/cache/my_thumb/relative/path/to/image.jpg. This is where Imagine would save the filtered image file.

HTTP Cache Headers

Configuration example:

Cache headers are set only for first request when image is generated. To solve this issue you should add additional configuration for your web server. Example for apache web server:

Configuration

The default configuration for the bundle looks like this:

There are several configuration options available:

Each filter that you specify have the following options:

Built-in Filters

Currently, this bundles comes with just one built-in filter: thumbnail.

Thumbnail

The thumbnail filter, as the name implies, performs a thumbnail transformation on your image. The configuration looks like this:

The mode can be either outbound or inset.

Resize

The resize filter may be used to simply change the width and height of an image irrespective of its proportions.

Consider the following configuration example, which defines two filters to alter an image to an exact screen resolution:

RelativeResize

The relative_resize filter may be used to heighten, widen, increase or scale an image with respect to its existing dimensions. These options directly correspond to methods on Imagine's BoxInterface.

Given an input image sized 50x40 (width, height), consider the following annotated configuration examples:

If you prefer using Imagine without a filter configuration, the RelativeResize class may be used directly.

Paste

The paste filter pastes an image into your image.

Chain

With chain filter you can apply some filters on your image. You can quite simply create a watermark filter:

Crop

The crop filter crop an image with start coordinate, and size dimension.

Load your Custom Filters

The ImagineBundle allows you to load your own custom filter classes. The only requirement is that each filter loader implement the following interface:

Skies\Bundle\ImagineBundle\Imagine\Filter\Loader\LoaderInterface

To tell the bundle about your new filter loader, register it in the service container and apply the following tag to it (example here in XML):

For more information on the service container, see the Symfony2 Service Container documentation.

You can now reference and use your custom filter when defining filters you'd like to apply in your configuration:

For an example of a filter loader implementation, refer to Skies\Bundle\ImagineBundle\Imagine\Filter\Loader\ThumbnailFilterLoader.

Caveats

If you are generating your image names from multiple parts in a Twig template, please be aware that Twig applies filters before concatenation, so

will apply your filter to '.jpg', and then concatenate the result to '/relative/path/to/' and some_variable. So the correct invocation would be

Using as a service

You can use ImagineBundle as a service and resolve the cached image path.

Then, call the getBrowserPath and pass the original image webpath and the filter you want to use

And also use ImagineBundle as a service and create the cache image from controller.


All versions of imagine-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version 2.* || 3.*
imagine/imagine Version v0.5.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 yellowskies/imagine-bundle contains the following files

Loading the files please wait ....