Reputation: 41
Need to display images for products without uploading on my server. I need to achieve:
Is it possible that we add image URL attribute like: ImageURL1, ImageURL2 and import both the image URL while product upload and Call them on Magento2 Website.
Upvotes: 4
Views: 3126
Reputation: 87
In Magento 2, product images are typically uploaded and stored in the pub/media directory. However, if you want to use external URLs for product images (i.e., images hosted outside of Magento), it requires a custom approach because Magento doesn't natively support external image URLs for products out of the box.
You can update external images using the following two approaches:
Approach 1: Customizing Product Image Handling (via Observer)
Approach 2: Override the Product Image URL in the Template
Upvotes: 0
Reputation: 494
Yes, you can add additional product attributes to store custom images from other server. But in order for them to be shown in your storefront, you'll need to adapt your product page templates, asking the product for this attributes and create the images with those URLs (when not empty values there).
Additionally if you'd like to serve all your media from a different server but only changing the domain part of the URL, you can use a CDN (content delivery network), which is supported by Magento out of the box, and can set setup in the Magento admin, menu STORES > Configuration > Web, groups "Base URLs" and "Base URLs (Secure)".
Hope that helps.
Upvotes: 0