Login / Status
developer.Resource
Home . Extensions . Repository
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

Extension Repository

The official extension repository only consists of freely available extensions. In the future only security reviewed extensions will be displayed. More information about reviews and disclaimer. New documentation is rendered once a day.


KJ: Image Lightbox v2


InfoRatingsFeedback


  • Icon
    kj_imagelightbox2
    Title
    KJ: Image Lightbox v2
    Extension key
    ( kj_imagelightbox2 )
    State
    stable, Not reviewed!
    Author
    Julian Kleinhans
    Category
    fe
    Version
    1.4.3
    Manual
    Read online
    Downloads (total / this version)
    59040 / 2972
    Rating
    4.45 (24 votes)
    Updated
    02.06.2008
    Upload comment
    Description
    Nice image feature for frontend. Also if you click on a picture, it will open in a animated JavaScript window and the whole background will be in a grey colour.
  • Dependencies
    • depends on cms
    • depends on typo3 3.8.0-
    • conflicts with mp_em_forimages
    • conflicts with popup_manager
    Reverse dependencies

    The following extension versions depend on this extension:

    Version history
    • 1.4.2: Fixed bug - wrong link to stylesheet.css - no caption when lightbox is not in use New features - add presentationmode (see screenshot above) - add option to change the next and prev image - add option to show always the next/prev image
    • 1.4.1: Update Manual Update ext_conf_template file - add image of label - add image of labelchange default values - add image of labeladd option to save image - add image of labeladd option to print image
    • 1.4.0: Update manual Refactoring the code Fix bugs add extension configuration. - you can set your own backgroundcolor - you can turn on/off dividers2tabs - you can set your own animation speed - you can set your own images for the close and loadingimage -
    • 1.3.1: See Manual
    • 1.3.0: See manual
    Download extension

    Download compressed extension .T3X file

  • Filename Size View Date Download
    ChangeLog 646 View 09.12.2007 Download
    bak.php 29 K View 09.12.2007 Download
    class.ux_tslib_content.php 31 K View 09.12.2007 Download
    ext_conf_template.txt 3.4 K View 09.12.2007 Download
    ext_icon.gif 556 View 09.12.2007 Download
    ext_localconf.php 199 View 09.12.2007 Download
    ext_tables.php 2.5 K View 09.12.2007 Download
    ext_tables.sql 280 View 09.12.2007 Download
    locallang_db.xml 2.2 K View 09.12.2007 Download
    doc/manual.sxw 662 K 09.12.2007 Download
    doc/wizard_form.dat 1.1 K 09.12.2007 Download
    doc/wizard_form.html 5.6 K 09.12.2007 Download
    lightbox/css/lightbox.css 2.8 K View 09.12.2007 Download
    lightbox/images/blank.gif 43 View 09.12.2007 Download
    lightbox/images/close.gif 222 View 09.12.2007 Download
    lightbox/images/close_2.gif 1.4 K View 09.12.2007 Download
    lightbox/images/closelabel.gif 1.0 K View 09.12.2007 Download
    lightbox/images/loading.gif 2.7 K View 09.12.2007 Download
    lightbox/images/next.gif 305 View 09.12.2007 Download
    lightbox/images/nextlabel.gif 354 View 09.12.2007 Download
    lightbox/images/prev.gif 307 View 09.12.2007 Download
    lightbox/images/prevlabel.gif 371 View 09.12.2007 Download
    lightbox/images/print.gif 168 View 09.12.2007 Download
    lightbox/images/save.gif 156 View 09.12.2007 Download
    lightbox/js/effects.js 31 K 09.12.2007 Download
    lightbox/js/lightbox.js 22 K 09.12.2007 Download
    lightbox/js/prototype.js 46 K 09.12.2007 Download
    lightbox/js/scriptaculous.js 2.1 K 09.12.2007 Download
    res/print.php 1.2 K View 09.12.2007 Download
    static/ImageLightbox_v2/constants.txt 11 View 09.12.2007 Download
    static/ImageLightbox_v2/setup.txt 847 View 09.12.2007 Download
    Preview for file kj_imagelightbox2-1.4.3-class__ux_tslib_content__php:
    
    <?php
    /***************************************************************
    *  Copyright notice
    *
    *  (c) 2005 Julian Kleinhans (typo3@kj187.de)
    *  All rights reserved
    *
    *  This script is part of the TYPO3 project. The TYPO3 project is
    *  free software; you can redistribute it and/or modify
    *  it under the terms of the GNU General Public License as published by
    *  the Free Software Foundation; either version 2 of the License, or
    *  (at your option) any later version.
    *
    *  The GNU General Public License can be found at
    *  http://www.gnu.org/copyleft/gpl.html.
    *
    *  This script is distributed in the hope that it will be useful,
    *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    *  GNU General Public License for more details.
    *
    *  This copyright notice MUST APPEAR in all copies of the script!
    ***************************************************************/
    /**
     * Imagelightbox v2
     * @author    Julian Kleinhans <typo3@kj187.de>
     */

    class ux_tslib_cObj extends tslib_cObj {



        
    // kj_imagelightbox2 - global var singleCaption
        
    var $singleCaption 0;

        
    /**
         * Returns a <img> tag with the image file defined by $file and processed according to the properties in the TypoScript array.
         * Mostly this function is a sub-function to the IMAGE function which renders the IMAGE cObject in TypoScript. This function is called by "$this->cImage($conf['file'],$conf);" from IMAGE().
         *
         * @param    string        File TypoScript resource
         * @param    array        TypoScript configuration properties
         * @return    string        <img> tag, (possibly wrapped in links and other HTML) if any image found.
         * @access private
         * @see IMAGE()
         */
        
    function cImage($file,$conf) {
            
    $info $this->getImgResource($file,$conf['file.']);
            
    $GLOBALS['TSFE']->lastImageInfo=$info;
            if (
    is_array($info))    {
                
    $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
                
    $GLOBALS['TSFE']->imagesOnPage[]=$info[3];        // This array is used to collect the image-refs on the page...

                
    if (!strlen($conf['altText']) && !is_array($conf['altText.']))    {    // Backwards compatible:
                    
    $conf['altText'] = $conf['alttext'];
                    
    $conf['altText.'] = $conf['alttext.'];
                }
                
    $altParam $this->getAltParam($conf);

                
    /**
                 * kj_imagelightbox2  - begin
                 */

                
    if($conf['imageLightbox2'] OR ($this->data['tx_kjimagelightbox2_imagelightbox2']==AND $this->data['image_zoom'] == AND $this->data['image_link'] == '')){
                    
    $extConf unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['kj_imagelightbox2']);

                    
    // dynamic CSS
                    
    $bgColor = ($extConf['bgColor'] != '') ? $extConf['bgColor'] : 'black';
                    
    $styleCloseButton = ($extConf['styleCloseButton'] != '') ? $extConf['styleCloseButton'] : '';
                    
    $cscCaption = ($extConf['cscCaption'] != '') ? $extConf['cscCaption'] : '';
                    
    $prevLinkImage = ($extConf['prevLinkImage'] != '') ? $extConf['prevLinkImage'] : '../images/prevlabel.gif';
                    
    $nextLinkImage = ($extConf['nextLinkImage'] != '') ? $extConf['nextLinkImage'] : '../images/nextlabel.gif';
                    
    $showNextPrevLinkImageAlways = ($extConf['showNextPrevLinkImageAlways'] == 1) ? ;
                    
    $presModeStyleActNumber = ($extConf['presModeStyleActNumber'] == '') ? 'color:#000000; font-weight:bold; text-decoration:none; width:100%;' $extConf['presModeStyleActNumber'] ;

                    
    $GLOBALS['TSFE']->additionalHeaderData['kj_imagelightbox2_dynCss'] = '
                        <style type="text/css">
                            /*<![CDATA[*/
                                #overlay {
                                    background-color: '
    .$bgColor.';
                                }
                                #imageData #bottomNavClose { 
                                    '
    .$styleCloseButton.'                                
                                }
                                .csc-textpic-caption {
                                    '
    .$cscCaption.'
                                }    
                                #prevLink, #nextLink {                        
                                    '
    .($showNextPrevLinkImageAlways == 'background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */' '').'
                                }    
                                #prevLink {
                                    '
    .($showNextPrevLinkImageAlways == 'background: url('.$prevLinkImage.') left 15% no-repeat;' '').'
                                }    
                                #nextLink {
                                    '
    .($showNextPrevLinkImageAlways == 'background: url('.$nextLinkImage.') right 15% no-repeat;' '').'
                                }
                                                            
                                #prevLink:hover, #prevLink:visited:hover { 
                                    background: url('
    .$prevLinkImage.') left 15% no-repeat; 
                                }
                                
                                #nextLink:hover, #nextLink:visited:hover { 
                                    background: url('
    .$nextLinkImage.') right 15% no-repeat; 
                                }    
                                .presentationmodeAct a:link {                        
                                    '
    .$presModeStyleActNumber.'
                                }                                
                            /*]]>*/
                        </style>
                    '
    ;


                    
    // dynamic JavaScript
                    
    $resizeSpeed = ($extConf['resizeSpeed'] != '')?$extConf['resizeSpeed']:7;
                    
    $fileLoadingImage = ($extConf['fileLoadingImage'] != '')?$extConf['fileLoadingImage']:'typo3conf/ext/kj_imagelightbox2/lightbox/images/loading.gif';
                    
    $fileBottomNavCloseImage = ($extConf['fileBottomNavCloseImage'] != '')?$extConf['fileBottomNavCloseImage']:'typo3conf/ext/kj_imagelightbox2/lightbox/images/closelabel.gif';
                    
    $numberDisplayLabel = ($extConf['numberDisplayLabel'] != '|')?$extConf['numberDisplayLabel']:'Image | of';
                    
    $numberDisplayLabel explode('|',$numberDisplayLabel);

                    
    $GLOBALS['TSFE']->additionalHeaderData['kj_imagelightbox2_dynJs'] = '
                        <script type="text/javascript">
                            /*<![CDATA[*/
                                var resizeSpeed = '
    .$resizeSpeed.';    // controls the speed of the image resizing (1=slowest and 10=fastest)    
                                var fileLoadingImage = "'
    .$fileLoadingImage.'";        
                                var fileBottomNavCloseImage = "'
    .$fileBottomNavCloseImage.'";
                                var numberDisplayLabelFirst = "'
    .$numberDisplayLabel[0].'";
                                var numberDisplayLabelLast = "'
    .$numberDisplayLabel[1].'";
                            /*]]>*/
                        </script>
                    '
    ;                

                    
    // add stylesheet and javascript to header
                    
    $GLOBALS['TSFE']->additionalHeaderData['kj_imagelightbox2_css'] = '<link rel="stylesheet" href="'.t3lib_extMgm::siteRelPath('kj_imagelightbox2').'lightbox/css/lightbox.css" type="text/css" media="screen" />';
                    
    $GLOBALS['TSFE']->additionalHeaderData['kj_imagelightbox2_js_prototype'] = '<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('kj_imagelightbox2').'lightbox/js/prototype.js"></script>';
                    
    $GLOBALS['TSFE']->additionalHeaderData['kj_imagelightbox2_js_scriptaculous'] = '<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('kj_imagelightbox2').'lightbox/js/scriptaculous.js?load=effects"></script>';
                    
    $GLOBALS['TSFE']->additionalHeaderData['kj_imagelightbox2_js_lightbox'] = '<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('kj_imagelightbox2').'lightbox/js/lightbox.js"></script>';

                    
    // maxWidth and maxHeight for the clicked image
                    
    $imageLightbox2Conf['maxW'] = ($extConf['imageLightbox2maxW']==700) ? $conf['file.']['imageLightbox2maxW']:$extConf['imageLightbox2maxW'];
                    
    $imageLightbox2Conf['maxH'] = ($extConf['imageLightbox2maxH']==700) ? $conf['file.']['imageLightbox2maxH']:$extConf['imageLightbox2maxH'];
                    
    $newinfo $this->getImgResource($info['origFile'],$imageLightbox2Conf);

                    
    // set caption from ts or data
                    
    $tempCap $this->stdWrap($conf['imageLightbox2.']['caption'],$conf['imageLightbox2.']['caption']);
                    
    $cap explode(chr(10),($tempCap=='' $this->data['imagecaption']:$tempCap));

                    
    // set name for imageset
                    
    $imgSetNumber = (intval($conf['imageLightbox2.']['imageset'])>0)?intval($conf['imageLightbox2.']['imageset']):$this->data['uid'];
                    
    $imgSet = ($this->data['tx_kjimagelightbox2_imageset']==OR intval($conf['imageLightbox2.']['imageset'])>0)?'['.$imgSetNumber.']':'';

                    if(
    $this->data['tx_kjimagelightbox2_presentationmode']!=AND $conf['imageLightbox2.']['presentMode'] !=1){
                        
    //save image icon
                        
    if($extConf['saveImageShow']==1){
                            if(
    $conf['file.']['saveImageShow'] == '' OR intval($conf['file.']['saveImageShow'])>0){
                                if(
    $conf['imageLightbox2.']['saveImageShow'] == '' OR intval($conf['imageLightbox2.']['saveImageShow'])>0){
                                    
    $saveImageIcon = ($extConf['saveImageIcon'] != '')?$extConf['saveImageIcon']:'typo3conf/ext/kj_imagelightbox2/lightbox/images/save.gif';
                                    
    $imageToolbar .= '&lt;a href=&quot;'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($newinfo[3])).'&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;'.$saveImageIcon.'&quot; border=&quot;0&quot; title=&quot;'.$extConf['saveImageIconTitle'].'&quot;&quot;&lt;/a&gt; &nbsp; ';
                                }
                            }
                        }else{
                            
    $imageToolbar .= '';
                        }

                        
    //print image icon
                        
    if($extConf['printImageShow']==1){
                            if(
    $conf['file.']['printImageShow'] == '' OR intval($conf['file.']['printImageShow'])>0){
                                if(
    $conf['imageLightbox2.']['printImageShow'] == '' OR intval($conf['imageLightbox2.']['printImageShow'])>0){
                                    
    $printImageIcon = ($extConf['printImageIcon'] != '')?$extConf['printImageIcon']:'typo3conf/ext/kj_imagelightbox2/lightbox/images/print.gif';
                                    
    $imageToolbar .= '&nbsp;&lt;a href=&quot;'.t3lib_extMgm::siteRelPath('kj_imagelightbox2').'res/print.php?image='.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($newinfo[3])).'&quot; target=&quot;_blank&quot; &gt;&lt;img src=&quot;'.$printImageIcon.'&quot; border=&quot;0&quot; title=&quot;'.$extConf['printImageIconTitle'].'&quot;&quot;&lt;/a&gt; &nbsp;';
                                }
                            }
                        }else{
                            
    $imageToolbar .= '';
                        }
                        
    $hideNumberDisplay 0;
                    }else{
                        
    // Presentationmode
                        
    $hideNumberDisplay 1;
                        
    $imageArrTmp explode(',',$this->data['image']);
                        
    $imageToolbar .= sizeof($imageArrTmp);
                        
    #$imageToolbar .= '&lt;span class=&quot;presentationmode presentationmodeSpan&quot; &gt;&lt;a href=&quot;#&quot; class=&quot;presentationmode&quot; id=&quot;'.$i.'&quot;  onClick=&quot;myLightbox.changeImage('.($i-1).'); return false;&quot;&gt;'.$i.'&lt;/a&gt;&lt;/span&gt;';
                        
    unset($imageArrTmp);
                    }
                    
    // get break
                    #$imageToolbar = ($imageToolbar=='')?'':chr(10).$imageToolbar;

                    // create the imagelink
                    
    $theValue '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($newinfo[3])).'" rel="lightbox'.$imgSet.'" title="'.$cap[$this->singleCaption].'" id="'.$this->singleCaption.'" showNumberDisplay="'.$hideNumberDisplay.'" kjtag="'.$imageToolbar.''.($this->data['tx_kjimagelightbox2_presentationmode'] ? '' $cap[$this->singleCaption]).'"><img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'"'.$this->getBorderAttr(' border="'.intval($conf['border']).'"').($conf['params']?' '.$conf['params']:'').($altParam).' /></a>';

                    
    $this->singleCaption++;

                    
    /**
                     * kj_imagelightbox2  - end
                     */


                    // kj_imagelightbox2 - add else
                
    } else {
                    
    $theValue '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'"'.$this->getBorderAttr(' border="'.intval($conf['border']).'"').($conf['params']?' '.$conf['params']:'').($altParam).' />';
                }

                if (
    $conf['linkWrap'])    {
                    
    $theValue $this->linkWrap($theValue,$conf['linkWrap']);
                } elseif (
    $conf['imageLinkWrap']) {
                    
    $theValue $this->imageLinkWrap($theValue,$info['origFile'],$conf['imageLinkWrap.']);
                }
                return 
    $this->wrap($theValue,$conf['wrap']);
            }
        }



        
    /**
         * Rendering the cObject, IMGTEXT
         *
         * @param    array        Array of TypoScript properties
         * @return    string        Output
         * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1
         */
        
    function IMGTEXT($conf) {

            
    /**
             * kj_imagelightbox2 - begin
             */
            
    $this->singleCaption 0;
            
    /**
             * kj_imagelightbox2 - end
             */    

            
    $content='';
            if (
    is_array($conf['text.']))    {
                
    $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']);    // this gets the surrounding content
            
    }
            
    $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.']));    // gets images
            
    if ($imgList)    {
                
    $imgs t3lib_div::trimExplode(',',$imgList);
                
    $imgStart intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));

                
    $imgCountcount($imgs)-$imgStart;

                
    $imgMax intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
                if (
    $imgMax)    {
                    
    $imgCount t3lib_div::intInRange($imgCount,0,$conf['imgMax']);    // reduces the number of images.
                
    }

                
    $imgPath $this->stdWrap($conf['imgPath'],$conf['imgPath.']);

                
    // initialisation
                
    $caption='';
                
    $captionArray = array();
                if (!
    $conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.']))    {
                    
    $caption $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);    // global caption, no splitting
                
    }

                
    /**
                 * kj_imagelightbox2
                 * AND $this->data['tx_kjimagelightbox2_imagelightbox2']!=1   hinzugefügt                   
                 */             
                
    if ($conf['captionSplit'] && $conf['captionSplit.']['cObject'] && $this->data['tx_kjimagelightbox2_imagelightbox2']!=1)    {
                    
    $legacyCaptionSplit 1;
                    
    $capSplit $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
                    if (!
    $capSplit) {$capSplit=chr(10);}
                    
    $captionArray explode($capSplit$this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
                    while (list(
    $ca_key$ca_val) = each($captionArray))    {
                        
    $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
                    }
                }

                
    $tablecode='';
                
    $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);

                
    $tmppos $position&7;
                
    $contentPosition $position&24;
                
    $align $this->align[$tmppos];
                
    $cap = ($caption)?1:0;
                
    $txtMarg intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
                if (!
    $conf['textMargin_outOfText'] && $contentPosition<16)    {
                    
    $txtMarg=0;
                }

                
    $cols intval($this->stdWrap($conf['cols'],$conf['cols.']));
                
    $rows intval($this->stdWrap($conf['rows'],$conf['rows.']));
                
    $colspacing intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
                
    $rowspacing intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));

                
    $border intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
                
    $borderColor $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
                
    $borderThickness intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));

                
    $borderColor=$borderColor?$borderColor:'black';
                
    $borderThickness=$borderThickness?$borderThickness:1;

                
    $caption_align $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
                if (!
    $caption_align) {
                    
    $caption_align $align;
                }
                
    // generate cols
                
    $colCount = ($cols 1) ? $cols 1;
                if (
    $colCount $imgCount)    {$colCount $imgCount;}
                
    $rowCount = ($colCount 1) ? ceil($imgCount $colCount) : $imgCount;
                
    // generate rows
                
    if ($rows>1)  {
                &nbs