Murtack
Murtack

Reputation: 21

Thumbnail some S3 images with LiipImagineBundle

I'm trying to do thumbnails of already uploaded images on AWS S3.

I followed theses steps : https://io.serendipityhq.com/experience/how-to-use-liipimaginebundle-to-manage-thumbnails-through-amazon-s3/

But I still have something that do not work locally.

Image are still not visible like the link is broken. I can see in the DOM that the URL is : https://localhost:8000/media/cache/resolve/medium_thumb/articleImages/635fa37ca598a_check_ok.png (so it looks good, if I compare with previous tutorial)

But then when I reload page, URL must change, and it doesn't.

Here's my config :

services.yaml

liip_imagine:
    loaders:
        loader_aws_s3_images:
            stream:
                # This refers to knp_gaufrette filesystems configuration
                wrapper: gaufrette://articleImage_fs/
    resolvers:
        cache_resolver_aws_s3:
            aws_s3:
                bucket: '%env(AWS_PUBLIC_BUCKET_NAME)%'
                client_config:
                    credentials:
                        key: '%env(AWS_KEY)%'
                        secret: '%env(AWS_S3_SECRET_KEY)%'
                    region: 'us-east-1'
                    version: '2006-03-01'
                get_options:
                    Scheme: 'https'
                put_options:
                    CacheControl: 'max-age=86400'
    filter_sets:
        medium_thumb:
            data_loader: loader_aws_s3_images
            # We don't yet have a cache resolver configured
            cache: cache_resolver_aws_s3
            quality: 75
            filters:
                thumbnail: { size: [ 400, 400 ], mode: outbound }

knp_gaufrette.yaml

knp_gaufrette:
    stream_wrapper: ~
    adapters:
        articleImage_adapter:
            aws_s3:
                service_id: 'ct_file_store.s3'
                bucket_name: '%env(AWS_PUBLIC_BUCKET_NAME)%'
                detect_content_type: true
                options:
                    create: true
                    directory: 'articleImages'
    filesystems:
        articleImage_fs:
            adapter: articleImage_adapter

list.html.twig

<img src="{{ article.image ? (aws_public_bucket ~ blogImages_path ~ article.image.blogImageName)|imagine_filter('medium_thumb') : asset('images/blog/placeholder-image.png') }}" alt="{{ article.title }}" class="img-responsive img-article">

Actually, if I put '|imagine_filter('medium_thumb')' right after 'asset('images/blog/placeholder-image.png')', thumbnail is working but not for images coming from AWS S3.

Please any advices ?

Upvotes: 2

Views: 264

Answers (0)

Related Questions