Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.x' into 2-to-3
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Jan 2, 2024
2 parents 7012928 + 7971043 commit 7947c88
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 38 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ jobs:
# Test Symfony 5.4 dev version
- php: '8.0'
dependencies: highest
symfony: '5.4.*'
symfony: '6.4.*'
stability: 'dev'

# Test Symfony 6.0 dev version
- php: '8.0'
# Test Symfony 7.0 dev version
- php: '8.2'
dependencies: highest
symfony: '6.0.*'
symfony: '7.0.*'
stability: 'dev'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure coverage driver
id: coverage
Expand All @@ -66,7 +66,7 @@ jobs:
if: matrix.symfony != '*'
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-interaction --no-progress symfony/flex:^1.11
composer global require --no-interaction --no-progress symfony/flex
composer config extra.symfony.require ${{ matrix.symfony }}
- name: Set minimum-stability
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ for a given releases. Unreleased, upcoming changes will be updated here periodic

- The response when the `filter` parameter in a resolve request is not an array is now 400 bad request, and no longer 404 not found.

## [2.12.1](https://github.com/liip/LiipImagineBundle/tree/2.12.1)

- Adjustments to install with Symfony 7 ([mbabker](https://github.com/liip/LiipImagineBundle/pull/1535))

## [2.12.0](https://github.com/liip/LiipImagineBundle/tree/2.12.0)

- Fix documentation filter command parameter name ([rdavaillaud](https://github.com/liip/LiipImagineBundle/pull/1515))
Expand Down
34 changes: 17 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "symfony-bundle",
"description": "This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.",
"keywords": [ "imagine", "image", "manipulation", "pictures", "photos", "transformation", "bundle", "symfony", "liip" ],
"homepage": "http://liip.ch",
"homepage": "https://www.liip.ch",
"license": "MIT",
"authors": [
{
Expand All @@ -25,34 +25,34 @@
"php": "^8.0",
"ext-mbstring": "*",
"imagine/imagine": "^1.3.2",
"symfony/filesystem": "^5.3|^6.0",
"symfony/finder": "^5.3|^6.0",
"symfony/framework-bundle": "^5.3|^6.0",
"symfony/mime": "^5.3|^6.0",
"symfony/options-resolver": "^5.3|^6.0",
"symfony/process": "^5.3|^6.0",
"symfony/filesystem": "^5.3|^6.0|^7.0",
"symfony/finder": "^5.3|^6.0|^7.0",
"symfony/framework-bundle": "^5.3|^6.0|^7.0",
"symfony/mime": "^5.3|^6.0|^7.0",
"symfony/options-resolver": "^5.3|^6.0|^7.0",
"symfony/process": "^5.3|^6.0|^7.0",
"twig/twig": "^2.9|^3.0"
},
"require-dev": {
"ext-gd": "*",
"amazonwebservices/aws-sdk-for-php": "^1.0",
"aws/aws-sdk-php": "^2.4",
"aws/aws-sdk-php": "^2.4|^3.0",
"doctrine/persistence": "^1.3|^2.0",
"league/flysystem": "^1.0|^2.0|^3.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-symfony": "^1.0",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/log": "^1.0",
"symfony/browser-kit": "^5.3|^6.0",
"symfony/cache": "^5.3|^6.0",
"symfony/console": "^5.3|^6.0",
"symfony/dependency-injection": "^5.3|^6.0",
"symfony/form": "^5.3|^6.0",
"symfony/messenger": "^5.3|^6.0",
"symfony/phpunit-bridge": "^5.3|^6.0",
"symfony/browser-kit": "^5.3|^6.0|^7.0",
"symfony/cache": "^5.3|^6.0|^7.0",
"symfony/console": "^5.3|^6.0|^7.0",
"symfony/dependency-injection": "^5.3|^6.0|^7.0",
"symfony/form": "^5.3|^6.0|^7.0",
"symfony/messenger": "^5.3|^6.0|^7.0",
"symfony/phpunit-bridge": "^5.3|^6.0|^7.0",
"symfony/templating": "^5.3|^6.0",
"symfony/validator": "^5.3|^6.0",
"symfony/yaml": "^5.3|^6.0"
"symfony/validator": "^5.3|^6.0|^7.0",
"symfony/yaml": "^5.3|^6.0|^7.0"
},
"suggest": {
"ext-exif": "required to read EXIF metadata from images",
Expand Down
4 changes: 2 additions & 2 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ The default configuration for the bundle looks like this:
filters: []
post_processors: []
controller:
filter_action: liip_imagine.controller:filterAction
filter_runtime_action: liip_imagine.controller:filterRuntimeAction
filter_action: liip_imagine.controller::filterAction
filter_runtime_action: liip_imagine.controller::filterRuntimeAction
redirect_response_code: 302
webp:
generate: false
Expand Down
10 changes: 8 additions & 2 deletions doc/data-loader/flysystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Using `OneupFlysystemBundle`_, a basic configuration might look as follows:

.. code-block:: yaml
# app/config/config.yml
# /config/liip_imagine.yaml
liip_imagine:
loaders:
Expand All @@ -42,6 +42,9 @@ Using `OneupFlysystemBundle`_, a basic configuration might look as follows:
filesystem_service: oneup_flysystem.profile_photos_filesystem
data_loader: profile_photos
# /config/oneup_flysystem.yaml
oneup_flysystem:
adapters:
profile_photos:
Expand All @@ -57,7 +60,7 @@ Using `The League FlysystemBundle`_:

.. code-block:: yaml
# app/config/config.yml
# /config/liip_imagine.yaml
liip_imagine:
loaders:
Expand All @@ -67,6 +70,9 @@ Using `The League FlysystemBundle`_:
filesystem_service: 'profile_photos.storage'
data_loader: profile_photos
# /config/flysystem.yaml
flysystem:
storages:
profile_photos.storage:
Expand Down
75 changes: 75 additions & 0 deletions doc/filters/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,81 @@ Interlace Options
``plane``, and ``partition``.


.. _filter-resample:

Resample
--------

The built-in ``resample`` filter provides a resampling transformation by allows you to
change the resolution of an image. This filter exposes a number of `resample options`_ which
may be used to configure its behavior.

.. tip::

Resampling changes the image resolution (also known as "pixel density") of an image
and is useful when you need to present different versions of an image dependent on
the user's screen density. For example, you may need to provide a "normal" and a
"retina" variant.

The use of "resolution" is not to be confused with "dimensions". This filter does not
affect the dimentions of an image, only the pixel density.


Example configuration:

.. code-block:: yaml
# app/config/config.yml
liip_imagine:
filter_sets:
# name our filter set "my_resample_filter"
my_resample_filter:
filters:
# use and setup the "resample" filter
resample:
# set the unit to use for pixel density
unit: ppi
# set the horizontal pixel density
x: 72
# set the vertical pixel density
y: 72
# set the resampling filter
filter: lanczos
# set the temporary path to use for resampling work
tmp_dir: /my/custom/temporary/directory/path
Resample Options
~~~~~~~~~~~~~~~~

**unit:** ``string``
Sets the unit to use for pixel density, either "pixels per inch" or "pixels per centimeter".
Valid values: ``ppi`` and ``ppc``.

**x:** ``int|float``
Sets the horizontal (x) pixel density to resample the image to.

**y:** ``int|float``
Sets the vertical (y) pixel density to resample the image to.

**filter:** ``string``
Sets the optional filter to use during the resampling operation. It must be a string resolvable
as a constant from `Imagine\Image\ImageInterface`_ (you may omit the ``FILTER_`` prefix)
or a valid fully qualified constant. By default it is set to ``FILTER_UNDEFINED``.

**tmp_dir:** ``string``
Sets the optional temporary work directory. This filter requires a temporary location to save
out and read back in the image binary, as these operations are requires to resample an image.
By default, it is set to the value of the `sys_get_temp_dir()`_ function.

.. _filter-strip:

Strip
Expand Down
4 changes: 4 additions & 0 deletions doc/filters/sizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Thumbnail Options
Sets the generated thumbnail size as an integer array containing the dimensions
as width and height values.

**allow_upscale:** ``bool``
Toggles allowing image up-scaling when the image is smaller than the desired
thumbnail size.

.. _filter-fixed:

Fixed size
Expand Down
6 changes: 6 additions & 0 deletions doc/post-processors/png-opti.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Options
When multi-images are encountered (for example, an animated image), this causes one of the images to be kept and drops
the other ones. Depending on the input format, this may be either the first or the most relevant (e.g. the largest) image.

**strip_all:** ``bool`` (deprecated)
Removes all comments, EXIF markers, and other image metadata.

**level:** ``int``
Sets the image optimization factor, from 0 to 7.

**strip:** ``bool|string``
When set to ``true``, all extra image headers, such as its comments, EXIF markers, and other metadata, will be removed.
Equivalently, the string value ``all`` also removes all extra metadata.
Expand Down
2 changes: 1 addition & 1 deletion doc/post-processors/png-quant.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ Parameters
----------

**liip_imagine.pngquant.binary:** ``string``
Sets the location of the ``pnquant`` executable. Default is ``/usr/bin/pngquant``.
Sets the location of the ``pngquant`` executable. Default is ``/usr/bin/pngquant``.
3 changes: 1 addition & 2 deletions src/Message/Handler/WarmupCacheHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
use Liip\ImagineBundle\Imagine\Filter\FilterManager;
use Liip\ImagineBundle\Message\WarmupCache;
use Liip\ImagineBundle\Service\FilterService;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;

/**
* Listen to WarmupCache messages and prepare the cache for those images.
*
* @experimental
*/
class WarmupCacheHandler implements MessageHandlerInterface
class WarmupCacheHandler
{
private FilterManager $filterManager;

Expand Down
8 changes: 0 additions & 8 deletions tests/Message/Handler/WarmupCacheHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Liip\ImagineBundle\Message\WarmupCache;
use Liip\ImagineBundle\Service\FilterService;
use Liip\ImagineBundle\Tests\Functional\AbstractWebTestCase;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\MessageBusInterface;

/**
Expand All @@ -34,13 +33,6 @@ protected function setUp(): void
}
}

public function testShouldImplementMessageHandlerInterface(): void
{
$rc = new \ReflectionClass(WarmupCacheHandler::class);

$this->assertTrue($rc->implementsInterface(MessageHandlerInterface::class));
}

public function testCouldBeConstructedWithExpectedArguments(): void
{
static::createClient();
Expand Down

0 comments on commit 7947c88

Please sign in to comment.