diff -urN share-2.0.0.dashboard/api/classes/CMap.php share/api/classes/CMap.php
--- share-2.0.0.dashboard/api/classes/CMap.php	2012-05-21 10:07:35.000000000 -0400
+++ share/api/classes/CMap.php	2012-07-10 15:06:15.000000000 -0400
@@ -426,6 +426,7 @@
 				if (!isset($result[$selement['sysmapid']]['selements'])) {
 					$result[$selement['sysmapid']]['selements'] = array();
 				}
+				$selement = $this->splitLabelLocationAndRotation($selement);
 				if (!is_null($options['preservekeys'])) {
 					$result[$selement['sysmapid']]['selements'][$selement['selementid']] = $selement;
 				}
@@ -783,6 +784,43 @@
 		return array('sysmapids' => $sysmapids);
 	}
 
+	/**
+	* Split the database label location to return the proper label_location and label rotation.
+	* In order to avoid modifying the database, we use the last digit to keep the label location and
+	* multiple the rotation angle by 10 to store it.
+	*
+	* @param array $selement an array containing the element data
+	* @return the updated array containing the element data
+	*/
+	private function splitLabelLocationAndRotation($selement) {
+		if (!is_null($selement['label_location'])) {
+			# We use decimals to store rotation. We only need the last digit for the location itself.
+			$selement['label_rotation'] = intval($selement['label_location']/10);
+			$selement['label_location'] = abs($selement['label_location']%10);
+		}
+		return $selement;
+	}
+	
+	/**
+	 * Merge the label location and label rotation field to be stored in the database.
+	 * In order to avoid modifying the database, we use the last digit to keep the label location and
+	 * multiple the rotation angle by 10 to store it.
+	 * 
+	 * @param array $selements multidimensional array with elements data
+ 	 * @return the updated multidimensional array with elements data
+	 */
+	private function mergeLabelLocationAndRotation($selements) {
+		foreach (array_keys($selements) as $key) {
+			if (key_exists('label_rotation', $selements[$key]) && !is_null($selements[$key]['label_rotation'])) {
+				# We use decimals to store rotation. We only need the last digit for the location itself.
+				$selements[$key]['label_location'] = $selements[$key]['label_location']+
+																							10*$selements[$key]['label_rotation'];
+			unset($selements[$key]['label_rotation']);
+			}
+		}
+		return $selements;
+	}
+	
 /**
  * Update Map
  *
@@ -875,11 +914,15 @@
 
 		// Selements
 		$newSelementids = array('selementids' => array());
-		if (!empty($selementsToAdd))
+		if (!empty($selementsToAdd)) {
+			$selementsToAdd = $this->mergeLabelLocationAndRotation($selementsToAdd);
 			$newSelementids = $this->createSelements($selementsToAdd);
+		}
 
-		if (!empty($selementsToUpdate))
+		if (!empty($selementsToUpdate)) {
+			$selementsToUpdate = $this->mergeLabelLocationAndRotation($selementsToUpdate);
 			$this->updateSelements($selementsToUpdate);
+		}
 
 		if (!empty($selementsToDelete))
 			$this->deleteSelements($selementsToDelete);
diff -urN share-2.0.0.dashboard/include/config.inc.php share/include/config.inc.php
--- share-2.0.0.dashboard/include/config.inc.php	2012-05-21 10:07:27.000000000 -0400
+++ share/include/config.inc.php	2012-06-28 14:01:42.000000000 -0400
@@ -89,7 +89,7 @@
 /*
  * start initialization
  */
-set_error_handler('zbx_err_handler');
+//set_error_handler('zbx_err_handler');
 unset($show_setup);
 
 if (defined('ZBX_DENY_GUI_ACCESS')) {
diff -urN share-2.0.0.dashboard/include/defines.inc.php share/include/defines.inc.php
--- share-2.0.0.dashboard/include/defines.inc.php	2012-05-21 10:07:27.000000000 -0400
+++ share/include/defines.inc.php	2012-07-10 13:32:12.000000000 -0400
@@ -270,6 +270,12 @@
 define('MAP_LABEL_LOC_RIGHT',		2);
 define('MAP_LABEL_LOC_TOP',			3);
 
+define('MAP_LABEL_ALIGN_CENTER',0);
+define('MAP_LABEL_ALIGN_BOTTOM',1);
+define('MAP_LABEL_ALIGN_LEFT',2);
+define('MAP_LABEL_ALIGN_RIGHT',3);
+define('MAP_LABEL_ALIGN_TOP',4);
+
 define('SYSMAP_ELEMENT_TYPE_HOST',		0);
 define('SYSMAP_ELEMENT_TYPE_MAP',		1);
 define('SYSMAP_ELEMENT_TYPE_TRIGGER',	2);
diff -urN share-2.0.0.dashboard/include/maps.inc.php share/include/maps.inc.php
--- share-2.0.0.dashboard/include/maps.inc.php	2012-05-21 10:07:27.000000000 -0400
+++ share/include/maps.inc.php	2012-07-10 15:11:08.000000000 -0400
@@ -1859,6 +1859,7 @@
 
 		$label_location = (is_null($selement['label_location']) || ($selement['label_location'] < 0))
 				? $map['label_location'] : $selement['label_location'];
+		$label_rotation = (!key_exists('label_rotation',$selement) || is_null($selement['label_rotation'])) ? 0 : $selement['label_rotation'];
 
 		$label = array();
 		if ($selement['label_type'] == MAP_LABEL_TYPE_IP && $selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
@@ -1910,55 +1911,144 @@
 
 		switch ($label_location) {
 			case MAP_LABEL_LOC_TOP:
-				$y_rec = $y - $icon_hl - $h - 6;
-				$x_rec = $x + $iconX / 2 - $w / 2;
+				switch ($label_rotation) {
+					case 90:
+						$align=MAP_LABEL_ALIGN_LEFT;
+						break;
+					case 270:
+						$align=MAP_LABEL_ALIGN_RIGHT;
+						break;
+					default:
+						$align=MAP_LABEL_ALIGN_CENTER;
+				}
 				break;
 			case MAP_LABEL_LOC_LEFT:
-				$y_rec = $y - $h / 2 + $iconY / 2;
-				$x_rec = $x - $icon_hl - $w;
+				switch ($label_rotation) {
+					case 0:
+						$align=MAP_LABEL_ALIGN_RIGHT;
+						break;
+					case 180:
+						$align=MAP_LABEL_ALIGN_LEFT;
+						break;
+					default:
+						$align=MAP_LABEL_ALIGN_CENTER;
+				}
 				break;
 			case MAP_LABEL_LOC_RIGHT:
-				$y_rec = $y - $h / 2 + $iconY / 2;
-				$x_rec = $x + $iconX + $icon_hl;
+				switch ($label_rotation) {
+					case 0:
+						$align=MAP_LABEL_ALIGN_LEFT;
+						break;
+					case 180:
+						$align=MAP_LABEL_ALIGN_RIGHT;
+						break;
+					default:
+						$align=MAP_LABEL_ALIGN_CENTER;
+				}
 				break;
-			case MAP_LABEL_LOC_BOTTOM:
 			default:
-				$y_rec = $y + $iconY + $icon_hl;
-				$x_rec = $x + $iconX / 2 - $w / 2;
+				switch ($label_rotation) {
+					case 90:
+						$align=MAP_LABEL_ALIGN_RIGHT;
+						break;
+					case 270:
+						$align=MAP_LABEL_ALIGN_LEFT;
+						break;
+					default:
+						$align=MAP_LABEL_ALIGN_CENTER;
+				}				
 		}
 
-		$increasey = 12;
-		foreach ($label as $line) {
-			if (zbx_empty($line['msg'])) {
-				continue;
-			}
-
-			$str = str_replace("\r", '', $line['msg']);
-			$color = isset($line['color']) ? $line['color'] : $colors['Black'];
-
-			$dims = imageTextSize(8, 0, $str);
-
-			if ($label_location == MAP_LABEL_LOC_TOP || $label_location == MAP_LABEL_LOC_BOTTOM) {
-				$x_label = $x + ceil($iconX / 2) - ceil($dims['width'] / 2);
-			}
-			elseif ($label_location == MAP_LABEL_LOC_LEFT) {
-				$x_label = $x_rec + $w - $dims['width'];
-			}
-			else {
-				$x_label = $x_rec;
-			}
+		$imgg=generateTextImage($label,$align,$label_rotation,8,$w,$labelFontHeight,$colors['Black'],$colors['White']);
+		
+		switch ($label_location) {
+			case MAP_LABEL_LOC_TOP:
+				switch ($label_rotation) {
+					case 90:
+					case 270:
+						$y_rec = $y - $icon_hl - 6 - imagesy($imgg);
+						$x_rec = ceil($x + ($iconX - imagesx($imgg)) / 2);
+						break;
+					default:
+						$y_rec = $y - $icon_hl - $h - 6;
+						$x_rec = $x + $iconX / 2 - $w / 2;
+				}
+				break;
+			case MAP_LABEL_LOC_LEFT:
+				switch ($label_rotation) {
+					case 90:
+					case 270:
+						$y_rec = ceil($y + ($iconY - imagesy($imgg))/2);
+						$x_rec = $x - $icon_hl - imagesx($imgg);
+						break;
+					default:
+						$y_rec = $y - $h / 2 + $iconY / 2;
+						$x_rec = $x - $icon_hl - $w;
+				}
+				break;
+			case MAP_LABEL_LOC_RIGHT:
+				case MAP_LABEL_LOC_LEFT:
+					switch ($label_rotation) {
+						case 90:
+						case 270:
+							$y_rec = ceil($y + ($iconY - imagesy($imgg))/2);
+							$x_rec = $x + $icon_hl + $iconX;
+							break;
+						default:
+							$y_rec = $y - $h / 2 + $iconY / 2;
+							$x_rec = $x + $iconX + $icon_hl;
+					}
+					break;
+				
+				break;
+			case MAP_LABEL_LOC_BOTTOM:
+			default:
+				switch ($label_rotation) {
+					case 90:
+					case 270:
+						$y_rec = $y + $iconY + $icon_hl + 6;
+						$x_rec = ceil($x + $iconX / 2 - imagesx($imgg) / 2);
+						break;
+					default:
+						$y_rec = $y + $iconY + $icon_hl;
+						$x_rec = $x + $iconX / 2 - $w / 2;
+				}
+		}
+		
+		imagecopy($im, $imgg, $x_rec, $y_rec, 0, 0, imagesx($imgg), imagesy($imgg));
+		imagedestroy($imgg);
+	}
+}
 
-			imagefilledrectangle(
-				$im,
-				$x_label - 1, $y_rec + $increasey - $labelFontHeight + $labelFontBaseline,
-				$x_label + $dims['width'] + 1, $y_rec + $increasey + $labelFontBaseline,
-				$colors['White']
-			);
-			imagetext($im, 8, 0, $x_label, $y_rec + $increasey, $color, $str);
 
-			$increasey += $labelFontHeight + 1;
+function generateTextImage($label, $align, $angle, $fontSize, $maxWidth, $maxHeight, $fgColor, $bgColor) {
+	$imgg = imagecreatetruecolor($maxWidth + 1, count($label) * ($maxHeight+1));
+	$offset=0;
+	imagefill($imgg,0,0,$bgColor);
+	for ($i=0;$i!=count($label);$i++) {
+		$line=$label[$i];
+		$color = isset($line['color']) ? $line['color'] : $fgColor;
+		$str = str_replace("\r", '', $line['msg']);
+		$dims = imageTextSize(8, 0, $str);
+		switch ($align) {
+			case MAP_LABEL_ALIGN_RIGHT:
+				$x=$maxWidth-$dims['width'];
+				break;
+			case MAP_LABEL_ALIGN_CENTER:
+				$x=ceil(($maxWidth-$dims['width'])/2);
+				break;
+			default:
+				$x=0;
 		}
+		imageText($imgg, $fontSize, 0, $x, $dims['height'] + $offset - $dims['baseline'], $color, $str);
+		$offset+=$maxHeight+1;
+	}
+	imagealphablending($imgg, false);
+	imagesavealpha($imgg, false);
+	if ($angle != 0) {
+		$imgg=imagerotate($imgg, $angle, $bgColor);
 	}
+	return $imgg;
 }
 
 /**
diff -urN share-2.0.0.dashboard/include/views/js/configuration.sysmaps.js.php share/include/views/js/configuration.sysmaps.js.php
--- share-2.0.0.dashboard/include/views/js/configuration.sysmaps.js.php	2012-05-21 10:07:27.000000000 -0400
+++ share/include/views/js/configuration.sysmaps.js.php	2012-07-10 15:16:06.000000000 -0400
@@ -74,7 +74,19 @@
 						<option value="<?php echo MAP_LABEL_LOC_LEFT; ?>"><?php echo _('Left'); ?></option>
 						<option value="<?php echo MAP_LABEL_LOC_RIGHT; ?>"><?php echo _('Right'); ?></option>
 						<option value="<?php echo MAP_LABEL_LOC_TOP; ?>"><?php echo _('Top'); ?></option>
-					</select></td>
+					</select>
+					</td>
+				</tr>
+				<tr>
+					<td><label for="label_rotation"><?php echo _('Label rotation'); ?></label></td>
+					<td><select id="label_rotation" class="input" name="label_rotation">
+							<option value="0">-</option>
+							<option value="90">-90</option>
+							<option value="180">180</option>
+							<option value="270">90</option>
+						</select>
+						</td>
+					</td>
 				</tr>
 				<tr id="hostGroupSelectRow">
 					<td><?php echo _('Host group'); ?></td>
@@ -314,6 +326,21 @@
 							<option value="<?php echo MAP_LABEL_LOC_RIGHT; ?>"><?php echo _('Right'); ?></option>
 							<option value="<?php echo MAP_LABEL_LOC_TOP; ?>"><?php echo _('Top'); ?></option>
 						</select>
+						</td>
+					</td>
+				</tr>
+				<tr>
+					<td>
+						<input type="checkbox" name="chkbox_label_Rotation" id="chkboxLabelRotation" class="checkbox" style="display: inline; ">
+						<label for="chkboxLabelRotation"><?php echo _('Label rotation'); ?></label>
+					</td>
+					<td><select id="massLabelRotation" class="input" name="label_rotation">
+							<option value="0">-</option>
+							<option value="90">-90</option>
+							<option value="180">180</option>
+							<option value="270">90</option>
+						</select>
+						</td>
 					</td>
 				</tr>
 				<tr>
diff -urN share-2.0.0.dashboard/js/class.cmap.js share/js/class.cmap.js
--- share-2.0.0.dashboard/js/class.cmap.js	2012-05-21 10:07:27.000000000 -0400
+++ share/js/class.cmap.js	2012-07-10 15:16:47.000000000 -0400
@@ -728,7 +728,8 @@
 					elementid: 0,
 					iconid_off: this.sysmap.iconList[0].imageid, // first imageid
 					label: locale['S_NEW_ELEMENT'],
-					label_location: this.sysmap.data.label_location, // set default map label location
+					label_location: this.sysmap.data.label_location%10, // set default map label location
+					label_rotation: Math.floor(this.sysmap.data.label_location/10), // set default map label rotation
 					x: 0,
 					y: 0,
 					urls: {},
@@ -792,7 +793,7 @@
 				var fieldName,
 					dataFelds = [
 						'elementtype', 'elementid', 'iconid_off', 'iconid_on', 'iconid_maintenance',
-						'iconid_disabled', 'label', 'label_location', 'x', 'y', 'elementsubtype',  'areatype', 'width',
+						'iconid_disabled', 'label', 'label_location', 'label_rotation', 'x', 'y', 'elementsubtype',  'areatype', 'width',
 						'height', 'viewtype', 'urls', 'elementName', 'use_iconmap'
 					],
 					fieldsUnsettable = ['iconid_off', 'iconid_on', 'iconid_maintenance', 'iconid_disabled'],
