1

I have embedded the images using views twig template,

file_url(row['content']['#row']._entity.field_future_program_image.entity.fileuri) %}

The output is public://2018-07/10a_0_0.JPG

Instead, I need the image URL from the s3 bucket: https://s3.bucketname/2018-07/10a_0_0.JPG

Note: I have configured amazon s3 and moved the local files to s3

1 Answer 1

1

Try adding

$settings['s3fs.use_s3_for_public'] = TRUE;

After that clear cache, now your site images will render form Amazon S3 bucket.

7
  • Hi Ajay, I used as below {{ file_create_url(row['content']['#row']._entity.field_future_program_image.entity.fileuri) }}, but it throws error. as Uncaught PHP Exception Twig_Error_Syntax: "Unknown "file_create_url" function."
    – Immaculate
    Aug 27, 2018 at 9:27
  • Use it as file_create_url(file_url(row['content']'#row']._entity.field_future_program_image.entity.fileuri) %})
    – Ajay Reddy
    Aug 27, 2018 at 9:29
  • Hi Ajay, I used both methods: Step1: {% set photo = file_create_url(file_url(row['content']'#row']._entity.field_future_program_image.entity.fileuri) %}) <img src="{{photo}}"> Step2: {% set photo = file_create_url(file_url(row['content']'#row']._entity.field_future_program_image.entity.fileuri)) %} <img src="{{photo}}"> But the below error is encountered. Uncaught PHP Exception Twig_Error_Syntax: "Unclosed "("."
    – Immaculate
    Aug 27, 2018 at 9:50
  • Can you post the error you are getting?
    – Ajay Reddy
    Aug 27, 2018 at 9:51
  • Uncaught PHP Exception Twig_Error_Syntax: "Unclosed "("." I have used as below: {% set photo = file_create_url(file_url(row['content']['#row']._entity.field_future_program_image.entity.fileuri)) %} <img src="{{photo}}">
    – Immaculate
    Aug 27, 2018 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.