18 require_once SQ_CORE_PACKAGE_PATH.
'/designs/design_area/design_area.inc';
43 parent::__construct($assetid);
61 if ($name ==
'black_colour' || $name ==
'white_colour'
62 || stristr($name,
'from_colour') || stristr($name,
'to_colour')) {
63 $new_value = $this->vars[
'colours'][
'value'];
64 if (!is_array($new_value)) $new_value = Array();
65 $new_value[$name] = $value;
70 if ($name ==
'type' && $value !=
'multiple_colours') {
74 return parent::setAttrValue($name, $value);
87 public function attr($name)
89 if (empty($this->vars[
'colours'][
'value'][$name])) {
90 return parent::attr($name);
92 return $this->vars[
'colours'][
'value'][$name];
106 if (!isset($this->_tmp[
'image'])) {
107 trigger_error(
'no image');
110 $image =
'assets/'.$this->type().
'/'.$this->
id.
'/'.$this->_tmp[
'image'];
112 if ($this->
attr(
'filename_only')) {
114 echo
'<',
'?php echo $DATA_PATH; ?>/', $image;
117 echo
'<img src="<',
'?php echo $DATA_PATH; ?',
'>/', $image,
'" ', $this->
attr(
'extra'),
' />';
133 $image_asset = $GLOBALS[
'DESIGN_BEING_GENERATED']->getAssociatedFile($this->
attr(
'image'));
134 if (is_null($image_asset)) {
135 trigger_localised_error(
'CORE0184', E_USER_WARNING, $this->
attr(
'id_name'), $this->
attr(
'image'));
140 $source = $image_asset->data_path.
'/'.$image_asset->attr(
'name');
141 if (!file_exists($source)) {
142 trigger_localised_error(
'CORE0183', E_USER_WARNING, $this->
attr(
'id_name'), $source);
146 if ($this->
attr(
'type') ==
'greyscale') {
147 $colours = $this->
attr(
'colours');
148 if (!isset($colours[
'black_colour']) || !isset($colours[
'white_colour'])) {
149 trigger_localised_error(
'CORE0186', E_USER_WARNING, $this->
attr(
'id_name'));
169 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
170 require_once SQ_FUDGE_PATH.
'/image/image_manip.inc';
172 $image_asset = $GLOBALS[
'DESIGN_BEING_GENERATED']->getAssociatedFile($this->
attr(
'image'));
173 $source = $image_asset->data_path.
'/'.$image_asset->attr(
'name');
176 $dest = $this->data_path_public.
'/colourised_'.$GLOBALS[
'DESIGN_BEING_GENERATED']->id.
'_'.$this->
attr(
'image');
178 if (!create_directory($this->data_path_public)) {
179 trigger_localised_error(
'CORE0185', E_USER_WARNING, $this->
attr(
'id_name'), $this->data_path_public);
183 $colours = $this->
attr(
'colours');
185 switch ($this->
attr(
'type')) {
189 $this->_tmp[
'image'] = basename($dest);
193 case 'multiple_colours' :
194 $colour_map = Array();
196 while (isset($colours[
'from_colour_'.$i]) && isset($colours[
'to_colour_'.$i])) {
197 $colour_map[$colours[
'from_colour_'.$i]] = $colours[
'to_colour_'.$i];
201 $this->_tmp[
'image'] = basename($dest);
206 trigger_localised_error(
'CORE0182', E_USER_WARNING, $this->
attr(
'id_name'), $this->get_val(
'type'));
224 $res = parent::getProtectedAttrs();