1

I have an EC2 instance in AWS, running NGINX, php-fpm and 3 small magento stores. Each store has its corresponding RDS.

In one of the shops did the integration with S3 service, quietly.

However, in the other, the integration is done but the images are downloaded instead of displayed.

The store in question does not have the DNS propagated yet, I'm aecssando by inserting the field in the hosts file. Already the shop where the S3 is working is accessed directly via static IP assigned to instance.

Could anyone help me?

2 Answers 2

1

I solve this issue changing the content-type for all files for image/jpeg

To do this, to change all of the image in one time, I used the GUI for S3 - DragonDisk 1.0.5 - Ubuntu version.

1

normally this issue arise when content type is wrong for the file. you have not mentioned how you have uploaded file to s3 but if you uploading a file to s3 through code and s3 library then you must need to pass content type with the correct value.

example of s3 put object function.

$s3->putObject([
'Bucket'=>$bucket,
'Key'=>$key,
'Body'=>$body,
'CacheControl'=>'max-age=172800',
'ContentType'=>$mime

]);

where $bucket is the target bucket, $key is a string, $body is a blob, and $mime is one of the following possible types:

  • image/png
  • image/jpeg
  • image/gif

and if you have directly uploaded to s3 manually then you need to change existing files content type manually or using s3 GUI

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.