索纳塔媒体Liip Imagine Integration

时间:2014-03-14 12:14:01

标签: symfony sonata-admin liipimaginebundle sonata-media-bundle

我正在尝试使用Liip Imagine按照集成说明生成Sonata Media的缩略图:

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

但我无法同时获得参考图像和缩略图的正确路径。我认为我的问题在于这个配置点:

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

使用Sonata媒体的原始配置

cdn:
    path: /uploads/media

参考图片网址没问题,但拇指不生成,网址如下:

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

遵循整合说明:

cdn:
    path: http://myapp.test

其中myapp.test使用symfony的默认htaccess指向我的基础根应用程序,拇指是使用公共URL正确生成的,如:

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

但是参考图像的公共网址是:

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

不存在,正确的网址是:

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

所有这些网址都是从奏鸣曲管理员处复制的。

跟随liipimagine整合说明的公寓可能需要触摸其他东西才能获得正确的参考图像网址?

我正在使用:

    "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 个答案:

答案 0 :(得分:1)

设置空字符串的路径对我有用:

cdn:
    server:
        path: ''

我在谷歌讨论的某个地方找到了这个解决方案,但我失去了参考。我不知道为什么奏鸣曲媒体项目的说明不正确。

我项目中的软件包版本:

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

N.B。确保你使用的是* x版本的liipimaginebundle,因为1. *版本不起作用(至少开箱即用)