Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External script #52

Open
bylli79 opened this issue Apr 24, 2021 · 1 comment
Open

External script #52

bylli79 opened this issue Apr 24, 2021 · 1 comment

Comments

@bylli79
Copy link

bylli79 commented Apr 24, 2021

Hello,
how can i use this module from an external script in php?

Thank you

@bylli79
Copy link
Author

bylli79 commented Apr 27, 2021

if I use this code
$sampleContent = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create();
$sampleContent->setFileData(
@codingStandardsIgnoreLine
base64_encode(file_get_contents( '/var/www/html/jellyfish_1_3.pdf'))
);
$sampleContent->setName('jellyfish_1_3.pdf');
$sampleContent->setType('application/octet-stream');

$upload =$objectManager->create(LizardMedia\ProductAttachment\Api\Data\File\ContentUploaderInterface::class);
$upload->upload($sampleContent,"file");

I get the following error:
PHP Fatal error: Uncaught Magento\Framework\Exception\RuntimeException: Type Error occurred when creating object: Magento\MediaGalleryIntegration\Plugin\SaveImageInformation, Argument 6 passed to Magento\MediaGalleryIntegration\Plugin\SaveImageInformation::__construct() must be of the type array, null given, called in /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 in /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:131

What can I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant