即使我对同一张照片使用完全相同的方式,我的imagine_filter在一个页面上工作,在其他页面上却不能工作,这是一个问题。
在我的过滤器工作的第一页中,我有这样的src:http://myserver.com/media/cache/shooting/photo_preview/75/55cb71cc8ba26-00001.jpg
然而,在过滤器不起作用的页面上,我有一个src:
:///media/cache/shooting/photo_preview/75/55cb71cc8ba26-00001.jpg
有人已经有这样的问题了吗?
此外,第一个src只适用于app.php,而不适用于app_dev.php.
在我的应用程序中,我使用Gaufrette将照片上传到S3,然后使用Liip应用过滤器。缓存在我的服务器上。这是我的配置:
"liip/imagine-bundle": "1.3.*@dev",
"knplabs/gaufrette": "0.1.*",
"knplabs/knp-gaufrette-bundle": "0.1.*@dev",
"aws/aws-sdk-php": "2.8.*@dev",
<---服务--->
services:
mycompany.aws_s3.client:
class: AwsS3S3Client
factory_class: AwsS3S3Client
factory_method: 'factory'
arguments:
-
key: %amazon_aws_key%
secret: %amazon_aws_secret_key%
region: %amazon_aws_region%
mycompany.liip_imagine.binary.loader.stream.shooting:
class: '%liip_imagine.binary.loader.stream.class%'
arguments:
- 'gaufrette://shooting/'
tags:
- { name: 'liip_imagine.binary.loader', loader: 'stream.shooting' }
<---Gaufrette--->
knp_gaufrette:
adapters:
shooting:
aws_s3:
service_id: mycompany.aws_s3.client
bucket_name: %amazon_s3_bucket%
options:
directory: shooting
filesystems:
shooting:
adapter: shooting
alias: shooting_filesystem
stream_wrapper: ~
<---Liip--->
liip_imagine:
resolvers:
default:
web_path: ~
shooting:
web_path:
cache_prefix: /media/cache/shooting
controller:
filter_action: mycompany_imagine.controller:filterAction
filter_sets:
photo_preview:
data_loader: stream.shooting
cache: shooting
quality: 50
filters:
upscale: { min: [690, 690] }
thumbnail: { size: [690, 690], mode: outbound}
<---Twig-->
<img src="{{ photo.imagepath | imagine_filter('photo_preview') }}" alt="">
我在Github上得到了答案。我只需要更换我的解析器:
https://github.com/liip/LiipImagineBundle/issues/203