4
votes

I am trying use Liip Imagine for generate thumbnails with Sonata Media following integration instructions:

http://sonata-project.org/bundles/media/master/doc/reference/extra.html#liip-imagine-bundle-integration

But I can't get correct path for the reference image and thumbnails at same time. I think my problem is with this configuration point:

cdn:
    # The CDN part must point to the base root of your application with a valid htaccess to match non existant
    # file. The non existant image will be send to the SonataMediaBundle:Media:liipImagineFilter controller.
    server:
        path:      http://mydomain.com

With original config for Sonata media

cdn:
    path: /uploads/media

The reference image url is OK but thumbs dont generate and their url are like:

/uploads/media/app_dev.php/uploads/media/cache/product/0001/01/18_product_small.jpg

Following integration instructions:

cdn:
    path: http://myapp.test

where myapp.test point to my base root app with default htaccess of symfony the thumbs are generated correctly with public url like:

http://myapp.test/app_dev.php/uploads/media/cache/product/0001/01/18_product_small.jpg

but the public url of the reference image is:

http://myapp.test/product/0001/01/113835a6853a.jpeg

that dont exist, the correct url is:

http://myapp.test/uploads/media/product/0001/01/113835a6853a.jpeg

All this urls are copied from sonata admin.

Appart of follow liipimagine integration instructions maybe a need touch something else for get correct reference image url?

I am using:

    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "sonata-project/admin-bundle": "dev-master",
    "sonata-project/doctrine-orm-admin-bundle": "dev-master",
    "sonata-project/intl-bundle": "dev-master",
    "sonata-project/media-bundle": "dev-master",
    "sonata-project/core-bundle": "dev-master",
    "a2lix/translation-form-bundle": "dev-master",
    "knplabs/doctrine-behaviors": "dev-master",
    "doctrine/doctrine-fixtures-bundle": "dev-master",
    "stfalcon/tinymce-bundle": "dev-master",
    "tilleuls/ckeditor-sonata-media-bundle": "dev-master",
    "egeloen/ckeditor-bundle": "2.*",
    "gedmo/doctrine-extensions": "dev-master",
    "friendsofsymfony/jsrouting-bundle": "1.*@dev",
    "asm/translation-loader-bundle": "~1.0",
    "lunetics/locale-bundle": "2.2.*",
    "craue/twigextensions-bundle": "~1.0",
    "sonata-project/formatter-bundle": "dev-master",
    "pixassociates/sortable-behavior-bundle": "dev-master",
    "liip/imagine-bundle": "dev-master"
1
I have the same issue, i can't configure SonataAdminBundle to use LiipImagineBundle in order to generate my thumbnails. is there anyway possible so my thumbnails will respect the width and height given in the config.yml instead of generating images by ratio ?Fanopsis
I have the same problem. Anybody found the solution ?Jaycreation

1 Answers

1
votes

Setting the path to an empty string worked for me:

cdn:
    server:
        path: ''

I found this solution somewhere on a google discussion, I lost the reference however. I don't know why the instructions on the sonata media project aren't correct.

Package versions in my project:

  • sonata-project/admin-bundle 2.3.1
  • sonata-project/media-bundle 2.3.1
  • liip/imagine-bundle 0.21.1

N.B. Make sure you are using a 0.* version of liipimaginebundle since 1.* versions do not work (out of the box at least)