Skip to content

askwhyweb/magento-media-as-url-api-update

Repository files navigation

Mage2 Module FiveTech GalleryImages

`fivetech/module-galleryimages`

Main Functionalities

Gallery Images update using URL.

Installation

* = in production please use the --keep-generated option

Type 1: Zip file

  • Unzip the zip file in app/code/FiveTech
  • Enable the module by running php bin/magento module:enable FiveTech_GalleryImages
  • Apply database updates by running php bin/magento setup:upgrade*
  • Flush the cache by running php bin/magento cache:flush

Type 2: Composer

  • Make the module available in a composer repository for example:
    • private repository repo.magento.com
    • public repository packagist.org
    • public github repository as vcs
  • Add the composer repository to the configuration by running composer config repositories.repo.magento.com composer https://repo.magento.com/
  • Install the module composer by running composer require fivetech/module-galleryimages
  • enable the module by running php bin/magento module:enable FiveTech_GalleryImages
  • apply database updates by running php bin/magento setup:upgrade*
  • Flush the cache by running php bin/magento cache:flush

Specifications

  • Plugin
    • aroundProcessMediaGallery - Magento\Catalog\Model\ProductRepository\MediaGalleryProcessor > FiveTech\GalleryImages\Plugin\Magento\Catalog\Model\ProductRepository\MediaGalleryProcessor

How to use

PUT Request to URL: {site-url}/rest/V1/products/{your-product-sku}

Body Request:

{
    "product": {
        "sku": "{your-product-sku}",
        "mediaGalleryEntries": [
            {
                "mediaType": "image",
                "label": "Test Product Image",
                "position": 1,
                "disabled": false,
                "file": "{your-url-to-image}", // https://d3708nxi8xs1qx.cloudfront.net/Image1.png
                "types": [
                    "image",
                    "thumbnail",
                    "small_image"
                ],
                "content": {
                    "base64EncodedData": "",
                    "type": "image/png", // keep it as per format e.g. png
                    "name": "desired_filename.png" // your-desired-filename
                }
            }
        ]
    }
}

About

No description, website, or topics provided.

Resources

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
LICENSE.txt
Unknown
COPYING.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages