protected function manageCustomizationImages()
    {
        $normal_image_sizes = ImageType::getImagesTypes($this->imageType);
        if (empty($this->wsObject->urlSegment[2])) {
            $results = Db::getInstance()->executeS('SELECT DISTINCT `id_cart` FROM `' . _DB_PREFIX_ . 'customization`');
            foreach ($results as $result) {
                $ids[] = $result['id_cart'];
            }
            asort($ids);
            $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('carts', array());
            foreach ($ids as $id) {
                $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('cart', array(), array('id' => $id, 'xlink_resource' => $this->wsObject->wsUrl . 'images/' . $this->imageType . '/' . $id), false);
            }
            $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('carts', array());
            return true;
        } elseif (empty($this->wsObject->urlSegment[3])) {
            $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('customizations', array());
            $customizations = $this->getCustomizations();
            foreach ($customizations as $id) {
                $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('customization', array(), array('id' => $id, 'xlink_resource' => $this->wsObject->wsUrl . 'images/' . $this->imageType . '/' . $id), false);
            }
            $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('customizations', array());
            return true;
        } elseif (empty($this->wsObject->urlSegment[4])) {
            if ($this->wsObject->method == 'GET') {
                $results = Db::getInstance()->executeS('SELECT *
					FROM `' . _DB_PREFIX_ . 'customized_data`
					WHERE id_customization = ' . (int) $this->wsObject->urlSegment[3] . ' AND type = 0');
                $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('images', array());
                foreach ($results as $result) {
                    $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $result['index'], 'xlink_resource' => $this->wsObject->wsUrl . 'images/' . $this->imageType . '/' . $result['index']), false);
                }
                $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('images', array());
                return true;
            }
        } else {
            if ($this->wsObject->method == 'GET') {
                $results = Db::getInstance()->executeS('SELECT *
					FROM `' . _DB_PREFIX_ . 'customized_data`
					WHERE id_customization = ' . (int) $this->wsObject->urlSegment[3] . '
					AND `index` = ' . (int) $this->wsObject->urlSegment[4]);
                if (empty($results[0]) || empty($results[0]['value'])) {
                    throw new WebserviceException('This image does not exist on disk', array(61, 500));
                }
                $this->imgToDisplay = _PS_UPLOAD_DIR_ . $results[0]['value'];
                return true;
            }
            if ($this->wsObject->method == 'POST') {
                $customizations = $this->getCustomizations();
                if (!in_array((int) $this->wsObject->urlSegment[3], $customizations)) {
                    throw new WebserviceException('Customization does not exist', array(61, 500));
                }
                $results = Db::getInstance()->executeS('SELECT id_customization_field
					FROM `' . _DB_PREFIX_ . 'customization_field`
					WHERE id_customization_field = ' . (int) $this->wsObject->urlSegment[4] . '
					AND type = 0');
                if (empty($results)) {
                    throw new WebserviceException('Customization field does not exist.', array(61, 500));
                }
                $results = Db::getInstance()->executeS('SELECT *
					FROM `' . _DB_PREFIX_ . 'customized_data`
					WHERE id_customization = ' . (int) $this->wsObject->urlSegment[3] . '
					AND `index` = ' . (int) $this->wsObject->urlSegment[4] . '
					AND type = 0');
                if (!empty($results)) {
                    // customization field exists and has no value
                    throw new WebserviceException('Customization field already have a value, please use PUT method.', array(61, 500));
                }
                return $this->manageDeclinatedImagesCRUD(false, '', $normal_image_sizes, _PS_UPLOAD_DIR_);
            }
            $results = Db::getInstance()->executeS('SELECT *
				FROM `' . _DB_PREFIX_ . 'customized_data`
				WHERE id_customization = ' . (int) $this->wsObject->urlSegment[3] . '
				AND `index` = ' . (int) $this->wsObject->urlSegment[4]);
            if (empty($results[0]) || empty($results[0]['value'])) {
                throw new WebserviceException('This image does not exist on disk', array(61, 500));
            }
            $this->imgToDisplay = _PS_UPLOAD_DIR_ . $results[0]['value'];
            $filename_exists = file_exists($this->imgToDisplay);
            return $this->manageDeclinatedImagesCRUD($filename_exists, $this->imgToDisplay, $normal_image_sizes, _PS_UPLOAD_DIR_);
        }
    }
 /**
  * This must be return a string with specific values as WebserviceRequest expects.
  *
  * @return string
  */
 public function getContent()
 {
     return $this->objOutput->getObjectRender()->overrideContent($this->output);
 }