2017-01-16 42 views
0

爲什麼我無法以這種方式更新圖像?如何將Bigcommerce產品圖像更新爲本地存儲的圖像?

Bigcommerce::createProductImage($product_id, array('image_file'=>'/home/user/bigcommerce/api/picture.jpg')); 

後續代碼的工作:

Bigcommerce::createProductImage($product_id, array('image_file'=>'https://cdn6.bigcommerce.com/s-0cvdh/products/32/images/299/apitec71q__46081.1484240387.1280.1280__30161.1484331218.1280.1280.jpg')); 

回答

1

按照documentation,它是不可能在本地上傳圖片。該文檔說:

When specifying a product image, the image_file should be specified as either: 
a path to an image already uploaded via FTP to the import directory (with the path 
relative to the import directory); or a URL to an image accessible on the internet. 
+0

謝謝!我需要更專心地閱讀文檔:) –

0

它不起作用,因爲BigCommerce服務器不知道「/home/user/bigcommerce/api/picture.jpg」所在的位置。這是一個存在於本地計算機上的文件,並且您將一個字符串傳遞給BigCommerce,告訴它在哪裏獲取文件。它適用於第二種情況,因爲BigCommerce可以訪問該URI。

更一般的說法是,您需要將圖片上傳到BigCommerce可以訪問的位置,然後傳遞一個BigCommerce可用來檢索圖像的URI。這看起來有點麻煩,但它可以讓BigCommerce不必通過API傳輸大量數據。

相關問題