I'm trying to use the magento api to create an image, but it's failing with the message
SoapFault exception: [104] Cannot create image.
This is not a helpful error message! What does this mean? Why is it doing this? How do I create an image, using the magento api?
This is my code:
$client = new SoapClient($wsdlurl);
$sessionId = $client->login($user, $key);
$file = array(
'content' =>
base64_encode(file_get_contents($filename)),
'mime' => 'image/jpeg',
'name' => 'newfile.jpg'
);
$result = $client->call(
$sessionId,
'catalog_product_attribute_media.create',
array(
$productId,
array('file'=>$file, 'label'=>'new_test_label', 'position'=>'100', 'types'=>array('thumbnail'), 'exclude'=>0)
)
);
What am I doing wrong?