I need to use all the pre-hosted images on AWS as a product images in magento. Is there a way to refer those image urls in magento without exactly uploading in magento ? Thanks !
1 Answer 1
I'm not overly familiar with 2.1, but in 1.x the answer is no, because Magento uses the media directory when it creates thumbnails for cache files.
You can sync these to and from an S3 bucket and use it for serving your assets (better; cloudfront over S3) to the frontend and admin areas easily enough, but you can't avoid having them stored on your server as well since files are created by the server as well.
There are some modules around which try to let you mount an S3 bucket to your file system, but since it is not designed to be a filesystem (S3) it doesn't tend to work very well.
If I were you:
- use an NFS share mounted media directory (if you have multiple web nodes)
- sync to and from S3 on a cron job- how often is up to you. Sync operations can use a fair amount of CPU, so do it in low traffic times.
- add a CloudFront distribution to point to your S3 bucket (distributed CDN), then;
- point your media directory (in configuration) at the CloudFront URL
-
1All, good points, Robbie. The same holds form Magento 2, the different image sizes are generated by Magento on the local filesystem which needs to be shared between the nodes.nikola99– nikola992017年01月15日 23:13:10 +00:00Commented Jan 15, 2017 at 23:13
-
Magneto code can be easily changed to get images from a different URL.Buttle Butkus– Buttle Butkus2017年01月16日 11:53:37 +00:00Commented Jan 16, 2017 at 11:53
-
@ButtleButkus yes, see my sentence about changing the settingscrowler– scrowler2017年01月16日 17:05:15 +00:00Commented Jan 16, 2017 at 17:05