rudiw

Update image in magento

Apr 27th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2. $proxy = new SoapClient('http://rudi.rudi.dev/berbatik/api/soap/?wsdl');
  3. echo "Login...\n";
  4. $sessionId = $proxy->login('sysadmin', 'admin123');
  5. echo "Loading...\n";
  6. $newImage = array(
  7.     'file' => array(
  8.         'name' => 'ImageTemp',
  9.         'content' => base64_encode(file_get_contents('ImageTemp.jpg')),
  10.         'mime'    => 'image/jpeg'
  11.     ),
  12.     'label'    => 'Cool Image Through Soap',
  13.     'position' => 2,
  14.     'types'    => array('small_image'),
  15.     'exclude'  => 0
  16. );
  17.  
  18. $imageFilename = $proxy->call($sessionId, 'product_media.create', array('K01', $newImage));
  19.  
  20.  
  21. var_dump($imageFilename);
  22.  
  23. // Updated image file
  24. var_dump($proxy->call($sessionId, 'product_media.list', 'K01'));
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment