Jump to content

"Blank images" problem when uploading product images through web services.


delaghetto

Recommended Posts

HI all, I please need help troubleshooting this situation:

 

- I've coded a script to upload product images according to the official docs in http://doc.prestashop.com/display/PS15/Chapter+9+-+Image+management

 

So my code is:

 

$url = PS_SHOP_PATH.'/api/images/products/'.$newproduct;
$image_path = './temp.jpg';
$key = PS_WS_AUTH_KEY;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image
curl_setopt($ch, CURLOPT_USERPWD, $key.':');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result_ws = curl_exec($ch);
curl_close($ch);

 

The problem is a totally white blank image is created for the product. This script is working perfectly in my local installation, but there is this problem in a remote installation I have in a cloud server.

 

- PHP memory limit is set to 256

- I've enabled debugging mode, but no errors are returned.

- I've set images.inc.php permissons to 755

 

Any ideas on what can be the problem? How can I check this CURL request for errors?

 

Thanks. Best regards.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...