wearejust/image-optim-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A Package with binaries to use image optimizers with Liip image

Installs: 1 046

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.0 2017-09-20 08:32 UTC

This package is not auto-updated.

Last update: 2023-04-01 19:51:54 UTC


README

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require wearejust/image-optim-bundle "~1"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Wearejust\ImageOptimBundle\WearejustImageOptimBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Add extra config to your config.yml file

It's possible to override the config we provide, you can specify an custom yml file (as Resources/config/theme.yml) the following way:

parameters:
  liip_imagine.jpegoptim.binary: '%kernel.root_dir%/../src/Wearejust/ImageOptimBundle/Resources/bin/jpegoptim'
  liip_imagine.optipng.binary: '%kernel.root_dir%/../src/Wearejust/ImageOptimBundle/Resources/bin/optipng-x64'
  liip_imagine.pngquant.binary: '%kernel.root_dir%/../src/Wearejust/ImageOptimBundle/Resources/bin/pngquant-x64'
  post_processes:
      jpegoptim: { strip_all: true, max: 70, progressive: true }
      optipng: { strip_all: true, level: 5 }

After adding this you will be able to use the post_processes variable in the defined filter presets. An example for this:

liip_imagine :

    filter_sets :
        cache : ~

        home_hero_image:
            quality: 100
            filters:
                thumbnail:
                    crop: { start: [0, 0], size: [1100, 1100] }
                    position: center
            post_processors: '%post_processes%'