【发布时间】:2010-09-17 13:51:03
【问题描述】:
我正在使用 magento api .. 在其中我使用了“catalog_product_attribute_media.create” ..如果它没有在该图像存在的服务器上获取图像,那会出现问题。 问题是..它阻止我的脚本进一步运行 我已经检查过 URL 是否不存在.. 但是我该如何处理这种情况,它正在获取 url ...但图像不存在
这是我的代码...
if($products[$counter]->small_image_url){//check if url exists
$newImage = array(
'file' => array(
'name' => 'file_name',
'content' => base64_encode(file_get_contents($products[$counter]->small_image_url)),
'mime' => 'image/jpeg'),
'label' => $products[$counter]->product_name,
'position' => 2,
'types' => array('thumbnail_image'),
'exclude' => 0
);
$imageFilename = $proxy->call($sessionId, 'product_media.create', array($sku, $newImage));
}
【问题讨论】: