Index: typo3/sysext/css_styled_content/static/setup.txt
===================================================================
--- typo3/sysext/css_styled_content/static/setup.txt	(Revision 8774)
+++ typo3/sysext/css_styled_content/static/setup.txt	(Arbeitskopie)
@@ -492,7 +492,10 @@
 
 			JSwindow = 1
 			JSwindow.newWindow = {$styles.content.imgtext.linkWrap.newWindow}
+			JSwindow.if.isFalse = {$styles.content.imgtext.linkWrap.lightboxEnabled}
 
+			directImageLink = {$styles.content.imgtext.linkWrap.lightboxEnabled}
+
 			enable.field = image_zoom
 			enable.ifEmpty.typolink.parameter.field = image_link
 			enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
@@ -502,6 +505,8 @@
 			typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
 			typolink.target = {$styles.content.links.target}
 			typolink.extTarget = {$styles.content.links.extTarget}
+			
+			linkParams.ATagParams.dataWrap =  class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"
 		}
 
 		altText = TEXT
@@ -720,8 +725,6 @@
 	stdWrap.prefixComment = 2 | Image block:
 }
 
-
-
 # *****************
 # CType: textpic
 # *****************
Index: typo3/sysext/css_styled_content/static/constants.txt
===================================================================
--- typo3/sysext/css_styled_content/static/constants.txt	(Revision 8774)
+++ typo3/sysext/css_styled_content/static/constants.txt	(Arbeitskopie)
@@ -39,9 +39,14 @@
   linkWrap.width = 800m
   linkWrap.height = 600m
   linkWrap.effects =
-
-    # cat=content/cImage/x; type=boolean; label= Advanced, New window: If set, every click-enlarged image will open in it's own popup window and not the current popup window (which may have a wrong size for the image to fit in)
+    # cat=content/cImage/c2; type=boolean; label= Advanced, New window: If set, every click-enlarged image will open in it's own popup window and not the current popup window (which may have a wrong size for the image to fit in)
   linkWrap.newWindow = 0
+  	# cat=content/cImage/c3; type=boolean; label= Lightbox click-enlarge rendering: Whether images with click-enlarge checked should be rendered lightbox-compliant
+  linkWrap.lightboxEnabled = 0
+   	# cat=content/cImage/c4; type=string; label= Lightbox CSS class: Which CSS class to use for lightbox links (only applicable if lightbox rendering is enabled)
+  linkWrap.lightboxCssClass = lightbox
+    # cat=content/cImage/c5; type=string; label= Lightbox rel="" attribute: Which rel="" attribute to use for lightbox links (only applicable if lightbox rendering is enabled)
+  linkWrap.lightboxRelAttribute = lightbox[{field:uid}]
 
   captionSplit = 0
     # cat=content/cImage/e1; type=boolean; label= Images, text split: If this is checked, then the image text (caption, alt, title, longdesc) will be split by each line and they will appear on the corresponding images in the imagelist.
@@ -72,7 +77,7 @@
   borderClass = csc-textpic-border  
     # cat=content/cImage/i5; type=boolean; label= Image row separation: Whether images should be rendered/wrapped in separated rows, e.g. inside a DIV.csc-textpic-imagerow element
   separateRows = 1
-    # cat=content/cImage/i5; type=boolean; label= Add clearer after intext images: Whether a clearer should be added after textpic elements of type intext-left or intext-right
+    # cat=content/cImage/i6; type=boolean; label= Add clearer after intext images: Whether a clearer should be added after textpic elements of type intext-left or intext-right
   addIntextClearer = 1
 }
 
Index: typo3/sysext/cms/tslib/class.tslib_content.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_content.php	(Revision 8774)
+++ typo3/sysext/cms/tslib/class.tslib_content.php	(Arbeitskopie)
@@ -3217,13 +3217,17 @@
 
 				$params .= '&md5=' . $md5_value . '&contentHash=' . $contentHash;
 				$url = $GLOBALS['TSFE']->absRefPrefix.'index.php?eID=tx_cms_showpic&file='.rawurlencode($imageFile).$params;
-				if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.'])	{
-					$altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
-					if ($altUrl)	{
-						$url = $altUrl . ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file='.rawurlencode($imageFile).$params);
+				
+				if($conf['directImageLink']) {
+					$url = $this->IMG_RESOURCE(
+						array_merge(array('file' => $imageFile, 'file.' => $conf))
+					);
+					if(!$url) {
+							// if no imagemagick / gm is available
+						$url = $imageFile;
 					}
 				}
-
+				
 					// Create TARGET-attribute only if the right doctype is used
 				if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype))	{
 					if (isset($conf['target']))	{
@@ -3234,8 +3238,14 @@
 				} else {
 					$target = '';
 				}
-
+				$conf['JSwindow'] = $this->stdWrap($conf['JSwindow'], $conf['JSwindow.']);
 				if ($conf['JSwindow'])	{
+					if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.'])	{
+						$altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
+						if ($altUrl)	{
+							$url = $altUrl . ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file='.rawurlencode($imageFile).$params);
+						}
+					}
 					$gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
 					$gifCreator->init();
 					$gifCreator->mayScaleUp = 0;
@@ -3248,8 +3258,8 @@
 					$a2='</a>';
 					$GLOBALS['TSFE']->setJS('openPic');
 				} else {
-					$a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
-					$a2='</a>';
+					$typoLinkConf = array_merge(array('parameter' => $url), $conf['linkParams.']);
+					$string = $this->typoLink($string, $typoLinkConf);
 				}
 
 				$string = $this->stdWrap($string,$conf['stdWrap.']);

