ugosansh / bundle-clientimage
来自图片API服务的客户端包(bundle-apiimage)
v1.2.0
2018-01-08 08:58 UTC
Requires
- php: >=5.4
- m6web/guzzle-http-bundle: ~2.0
- ugosansh/component-image: ~0.2
README
来自服务图片API的客户端
Beta版本
不要在生产环境中使用。
安装
将Bundle添加到您的composer.json文件中
"ugosansh/bundle-clientimage": "~0.1"
启用bundle
<?php class AppKernel extends Kernel { public function registerBundles() { $bundles = [ ... new Ugosansh\Bundle\Image\ClientBundle\UgosanshImageClientBundle(), ... ]; ?>
配置参考
ugosansh_image_client: api: # Node api based from m6web WsClientBundle base_url: "http://api.domain.tld" config: timeout: 2 exceptions: false logger: logger_service_name # (Option) A logger from WsClient service default_image: "img/default-image.jpg" # (Option) Define default image entity_class: Acme\Bundle\MyBundle\Entity\Image # (Option)
此bundle需要 https://github.com/M6Web/WsClientBundle
配置节点 api 扩展了WsClientBundle的配置参考。
从twig模板使用
<!-- render(ImageInterface image, int width = null, int height = null, int crop = null, array attr = []); -->
{{ image_render(image, 200, 100, 1, {'class': 'thumbnail'}) }}