dongyou5098 2015-05-11 22:15
浏览 52
已采纳

使用liipimaginebundle在树枝上即时生成动态缩略图

I'm trying to use liipImagineBundle in symfony to produce thumbnails on the fly. The url of the image to be used as a thumbnail being attached to an Entry entity, my twig file calls the image like so:

 <img src="{{ asset('uploads/images/') ~ entry.thumbnail | imagine_filter('my_thumb') }}" />

and it doesn't seem to work. I've tried tweaking the data_root attribute of liipimagine's config but without success. I can't seem to tell liip that my image is in web/uploads/images. The source html ends up looking like this:

 <img src="/projects/ootn_symf/web/uploads/images/http://localhost/projects/ootn_symf/web/app_dev.php/media/cache/resolve/my_thumb/my_image.jpg" />

Currently, liip's config is the following:

liip_imagine:
    resolvers:
       default:
          web_path: ~

    filter_sets:
        cache: ~
        my_thumb:
            quality: 75
            filters:
                thumbnail: { size: [120, 90], mode: outbound }

Not sure what to do here, can someone help me?

  • 写回答

2条回答 默认 最新

  • dongmeirang4679 2015-05-18 20:29
    关注

    Alright, figured it out. This is what needs to be done:

    <img src="{{ ('/uploads/images/' ~ entry.thumbnail) | imagine_filter('my_thumb') }}" />
    

    Apparently, no need for the asset function, liip already looks in the web directory. Just give the image source relative to that folder and you'll be fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分