From e96687636daed96918347cc63c5a2fde842a7950 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Thu, 20 Sep 2012 12:05:12 +0000 Subject: [PATCH] // Encode binary datas on the XML in the webservices git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17434 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/webservice/WebserviceOutputXML.php | 4 ++++ classes/webservice/WebserviceSpecificManagementImages.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/webservice/WebserviceOutputXML.php b/classes/webservice/WebserviceOutputXML.php index 455b0f128..6dcdc4fe4 100755 --- a/classes/webservice/WebserviceOutputXML.php +++ b/classes/webservice/WebserviceOutputXML.php @@ -124,6 +124,10 @@ class WebserviceOutputXMLCore implements WebserviceOutputInterface if ($field['value'] != '') $node_content .= ''; } + + if (isset($field['encode'])) + $ret .= ' encode="'.$field['encode'].'"'; + if (isset($field['synopsis_details']) && !empty($field['synopsis_details']) && $this->schemaToDisplay !== 'blank') { foreach ($field['synopsis_details'] as $name => $detail) diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index e71e71f6d..892b0b097 100755 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -978,7 +978,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage $this->imgToDisplay = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format; $this->objOutput->setFieldsToDisplay('full'); $this->output = $this->objOutput->renderEntity($image, 1); - $image_content = array('sqlId' => 'content', 'value' => file_get_contents($this->imgToDisplay)); + $image_content = array('sqlId' => 'content', 'value' => base64_encode(file_get_contents($this->imgToDisplay)), 'encode' => 'base64'); $this->output .= $this->objOutput->objectRender->renderField($image_content); } elseif (in_array($this->imageType, array('categories', 'manufacturers', 'suppliers', 'stores')))