ElPepito Posted April 18, 2016 Share Posted April 18, 2016 When I try to add an image to a product I don't get any errors, but the image doesn't get added. This is my code: function addImage($idProduct) { $key = 'XXXXXXXXXXXXXXXXXXX'; $url = "http://192.168.1.81/api/images/products/".$idProduct; $image_path = 'image2.jpg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_USERPWD, $key); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path.';type=image/jpg')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); echo '<h2>Image Added</h2>'; } I also made a change on PSWebServiceLibrary.php, because Prestashop Web Service API keeps asking for authentication. This is the link where I got the code Prestashop Web Service API keeps asking for authentication . This is the code I added: $url .= '&ws_key=' . $this->key; The problem is that the code to add an image was working before I made that change on PSWebServiceLibrary.php, and I don't know how to solve it. I am using prestashop 1.6.1.5 Any help will be appreciated. Greetings! Link to comment Share on other sites More sharing options...
ElPepito Posted April 19, 2016 Author Share Posted April 19, 2016 Hi mdekker I did what you said and it didnt work. The program doesn't give me any errors, but it doesn't add the image. Thanks for answering. Link to comment Share on other sites More sharing options...
ITI Posted October 12, 2016 Share Posted October 12, 2016 Did you find an solution?I have the same problem and no solution to add images in prestashop 1.6 > via de webservice. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now