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 Feb 26, 2024
2 parents cdc9727 + 118d419 commit 00d3dcf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 5 additions & 7 deletions doc/basic-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ available filters will be resolved).
Resolve Programmatically
~~~~~~~~~~~~~~~~~~~~~~~~

You can resolve the image URL in your code using the ``getBrowserPath``
method of the ``liip_imagine.cache.manager`` service. Assuming you already
have the service assigned to a variable called ``$imagineCacheManager``,
You can resolve the image URL in your code using the ``getBrowserPath`` method
of the ``Liip\ImagineBundle\Imagine\Cache\CacheManager`` service. Assuming you
already have the service assigned to a variable called ``$imagineCacheManager``,
you would run:

.. code-block:: php
Expand All @@ -214,17 +214,15 @@ you would run:
Often, you need to perform this operation in a controller.

You can access the ``CacheManager`` simply by type hinting it in your controller method: the service
``liip_imagine.cache.manager`` will be automatically injected and you will be able to call
``getBrowserPath`` on a relative image path to get its resolved location.
In a controller, this can look as follows:

.. code-block:: php
<?php
namespace App\Controller;
use \Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
class YourController
{
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/config/imagine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<argument type="service" id="liip_imagine" />
<argument type="service" id="liip_imagine.binary.mime_type_guesser" />
</service>
<service id="Liip\ImagineBundle\Imagine\Filter\FilterManager" alias="liip_imagine.filter.manager"/>

<service id="liip_imagine.data.manager" class="Liip\ImagineBundle\Imagine\Data\DataManager" public="true">
<argument type="service" id="liip_imagine.binary.mime_type_guesser" />
Expand All @@ -133,6 +134,7 @@
<argument>%liip_imagine.binary.loader.default%</argument>
<argument>%liip_imagine.default_image%</argument>
</service>
<service id="Liip\ImagineBundle\Imagine\Data\DataManager" alias="liip_imagine.data.manager"/>

<service id="liip_imagine.cache.manager" class="Liip\ImagineBundle\Imagine\Cache\CacheManager" public="true">
<argument type="service" id="liip_imagine.filter.configuration" />
Expand All @@ -142,6 +144,7 @@
<argument>%liip_imagine.cache.resolver.default%</argument>
<argument>%liip_imagine.webp.generate%</argument>
</service>
<service id="Liip\ImagineBundle\Imagine\Cache\CacheManager" alias="liip_imagine.cache.manager"/>

<service id="liip_imagine.filter.configuration" class="Liip\ImagineBundle\Imagine\Filter\FilterConfiguration">
<argument>%liip_imagine.filter_sets%</argument>
Expand Down
2 changes: 1 addition & 1 deletion tests/Imagine/Cache/Resolver/AwsS3ResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public function testCatchAndLogExceptionForFilterOnRemove(): void
}

/**
* @return MockObject&\Aws\S3\S3Client
* @return MockObject&S3Client
*/
protected function getS3ClientMock()
{
Expand Down

0 comments on commit 00d3dcf

Please sign in to comment.