Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Upload Images to AWS S3 Bucket Using Rich Editor Plugin #205

Open
yassine20011 opened this issue Sep 4, 2023 · 0 comments
Open

Comments

@yassine20011
Copy link

yassine20011 commented Sep 4, 2023

Hello, I use the Rich Editor plugin for specific sections on my website. However, I'm facing an issue where images are only uploaded to the public folder instead of my AWS S3 bucket. I've ensured that my AWS configuration is correct because I can successfully upload images on pages that do not utilize the Rich Editor plugin.

Here's a snippet from my monsieurbiz_sylius_rich_editor_plugin.yaml:

knp_gaufrette:
    adapters:
        sylius_image:
            aws_s3:
                service_id: acme.aws_s3.client
                bucket_name: "%aws_s3_bucket%"
                detect_content_type: true
                options:
                    create: true
                    directory: "media/image"
                    acl: "private"
        monsieurbiz_rich_editor_fixture_file:
            aws_s3:
                service_id: 'acme.aws_s3.client'
                bucket_name: '%aws_s3_bucket%'
                detect_content_type: true
                options:
                    create: true
                    directory: '/media/image'
                    acl: 'private'
    filesystems:
         sylius_image:
            adapter: sylius_image
        monsieurbiz_rich_editor_fixture_file:
            adapter: 'monsieurbiz_rich_editor_fixture_file'
        
monsieurbiz_sylius_richeditor:
    upload_directory: '/media/image'
    image_upload_directory: '/media/image'
    ui_elements:
        sections.hero:
            alias: hero
            title: 'Hero'
            description: 'Hero'
            icon: html5
            tags: [default]
            classes:
                form: App\Form\UiElement\HeroType
            templates:
                admin_render: 'bundles/SyliusAdminBundle/UiElement/hero.html.twig'
                front_render: '@MonsieurBizSyliusRichEditorPlugin/Shop/UiElement/html.html.twig'

Here' my config\services.yaml:

    env(AWS_ACCESS_KEY_ID): ""
    env(AWS_SECRET_ACCESS_KEY): ""
    env(AWS_BUCKET_NAME): ""
    env(AWS_REGION): ""
    aws_s3_key: "%env(AWS_ACCESS_KEY_ID)%"
    aws_s3_secret: "%env(AWS_SECRET_ACCESS_KEY)%"
    aws_s3_bucket: "%env(AWS_BUCKET_NAME)%"
    aws_s3_region: "%env(AWS_REGION)%"
    aws_s3_version: "2006-03-01"

services:
    # Default configuration for services in *this* file
    monolog.logger.paypal: '@logger'
    acme.aws_s3.client:
        class: Aws\S3\S3Client
        factory: [ Aws\S3\S3Client, 'factory' ]
        arguments:
            -
                version: "%aws_s3_version%"
                region: "%aws_s3_region%"
                credentials: { key: "%aws_s3_key%", secret: "%aws_s3_secret%" }
    acme.imagine.cache.resolver.aws_s3_resolver:
        class: Liip\ImagineBundle\Imagine\Cache\Resolver\AwsS3Resolver
        arguments:
            - "@acme.aws_s3.client"
            - "%aws_s3_bucket%"
            - "private"
            - { Scheme: https }
        tags:
            - { name: "liip_imagine.cache.resolver", resolver: "aws_s3" }

It seems that I have configured my YAML file to upload images to my AWS S3 bucket, but it's not working as expected. Any guidance or assistance on resolving this issue would be greatly appreciated.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant