echo $imagePath; C:\Documents and Settings\Jevgeni\Desktop\suured\17677.jpg
на выходе получаю:
Error assigning image to L-29-16: The image contents is not valid base64 data.
$fileContent = @base64_decode($data['file']['content'], true); if (!$fileContent) { $this->_fault('data_invalid', Mage::helper('catalog')->__('The image contents is not valid base64 data.')); }
В чем проблема? Вернее как так закодировать, чтобы он раскодировал?
$image_entry = $db->nextAsAssoc(); $imagePath = $dir.$image_entry['nimi']; if(file_exists($imagePath)){ $sku = $arr['kood']; $newImage = array( 'file' => array( 'name' => $image_entry['nimi'], 'content' => base64_encode(file_get_contents($imagePath)), 'mime' => 'image/jpeg' ), 'label' => "Item:" . $sku, 'position' => 0, 'types' => array('image', 'small_image', 'thumbnail' ), 'exclude' => 0 ); try { $imageFilename = $proxy->call($sessionId, 'product_media.create', array($sku, $newImage)); } catch(Exception $e) { print( "Error assigning image to $sku: " . $e->getMessage() . "\n" ); } }