0

Is there any extension that give us the possibility to add external url instead of a base64 string when I adding/update product via magento 2 api?

4
  • Not sure about it, but what if you convert the img to base 64 using the img url, I think you can do that as well.
    – fmsthird
    Commented Nov 18, 2020 at 7:36
  • I try to convert the img url to base 64 but magento don't like it :-) imgur.com/oTxMZ7h Error -> The image content must be valid base64 encoded data.
    – Seb
    Commented Nov 18, 2020 at 7:47
  • nah I mean get the contents of the img url then convert it to base_64
    – fmsthird
    Commented Nov 18, 2020 at 7:59
  • were you able to fix it?
    – fmsthird
    Commented Nov 18, 2020 at 11:01

1 Answer 1

0

an extension is available you can check this https://github.com/olivertar/m2_api_product_images

also, you can update that as per your need

https://github.com/olivertar/m2_api_product_images/blob/master/Orangecat/MediaGalleryProcessor/Model/MediaGalleryProcessorPlugin.php#L41

remove if condition here and update with following

$imagedata = file_get_contents($entry['file']);
if($imagedata){
    $entry['content'][ImageContentInterface::BASE64_ENCODED_DATA] = base64_encode($imagedata);
    $mediaGalleryEntries[$k]['content'][ImageContentInterface::BASE64_ENCODED_DATA] = base64_encode($imagedata);
}
2

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.