Ignore:
Timestamp:
Jul 15, 2012, 7:44:26 PM (12 years ago)
Author:
gbo
Message:

2.4F improve frame management first size and JS resize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LLGBO2/main.inc.php

    r16145 r16754  
    22/*
    33Plugin Name: Look_like_gbo2
    4 Version:  2.4.D
     4Version:  2.4.F
    55Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=251
    66Author: GBo
     
    1111        2.4.B beta 2 Compliance with Theme Stripped and plugin Piwishak 
    1212        2.4.C First version for official Piwigo 2.4
    13         2.4.D Compliance with Theme Simple
     13        2.4.D Compliance with Theme Simple + fix bug on option
     14        2.4.F Improvement on frame management first size
    1415 */
    1516if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1617
    1718global $conf;
    18 define ('LLGBO_INFO_VERSION','2.4.D');
     19define ('LLGBO_INFO_VERSION','2.4.F');
    1920if (!defined('LLGBO_PATH'))
    2021{define('LLGBO_PATH' ,get_root_url().'plugins/'.basename(dirname(__FILE__)) . '/');}
     
    6869function  llgbo_EndPicture()
    6970{ global $template,$conf;
    70 $infofile = $template->get_template_vars('INFO_FILE');
    71 
     71$infofile = $template->get_template_vars('INFO_FILE');
     72$current = $template->get_template_vars('current');
     73$slideshow = $template->get_template_vars('U_SLIDESHOW');
     74//----------------------------------------------------   
     75/*       HTML End  frame   on Picture.tpl       */
     76//---------------------------------------------------- 
     77If (($conf['LLGBO_SETTINGS'] [0] == 'true') and (!isset($slideshow)) ) //Frame
     78        { $template->set_prefilter('picture', 'LLGBO_prefilter_Picture_Frame');
     79                If (isset($conf['LLGBO_SETTINGS'] ['rirs']))
     80                { // Force javascript LlgboFr_Resize  to Read MainImage Reel Size via URL
     81                  // Must be used when html image is already resize by HTML (IE or Chrome)
     82                If ($conf['LLGBO_SETTINGS'] ['rirs']  == 'true') // Forcce javascript to read Image reel size
     83                        {$template->append('llgbo', array('READIMGREELSIZE'  => "ok"), true); }
     84                        }
     85// selected picture Size                       
     86        $PictSizeWH  =  $current['selected_derivative']->get_size();   
     87        $frame_width  = $PictSizeWH[0];
     88                $frame_height = $PictSizeWH[1];
     89                $lastbrdpx = 0;
     90                $frame_begin ='';
     91                for ($x = 1   ;$x < 32  ; $x =$x +2)
     92                {       if ((isset($conf['LLGBO_FRAME'][$x+1])) and  ($conf['LLGBO_FRAME'][$x+1] > 0))  // boder value > 0     
     93                          { $bordpx= $conf['LLGBO_FRAME'][$x+1];
     94                                $frame_width = $frame_width + ( 2* $lastbrdpx);                         
     95                                $frame_height = $frame_height + ( 2* $lastbrdpx);
     96                            $bordcolor = $conf['LLGBO_FRAME'][$x];
     97                            $frame_begin = '<div   id="llgboframe'.$x.'" class="llgbo" style="border:'.$bordpx.'px solid '.$bordcolor.';width:'.$frame_width.'px; height:'.$frame_height.'px;">'."\n".$frame_begin;
     98                                $lastbrdpx = $bordpx;}
     99                }
     100                $frame_width = $frame_width + ( 2* $lastbrdpx);                         
     101                $frame_height = $frame_height + ( 2* $lastbrdpx);
     102                $frame_size = 'style="border:0 ;width:'.$frame_width.'px; height:'.$frame_height.'px;"';
     103                $template->append('llgbo', array(
     104                         'FRAME_SIZE' => $frame_size,
     105                         'FRAME_BEGIN' => $frame_begin), true);
     106        If (($conf['LLGBO_SETTINGS'] [5]  == 'true' )  /* title on frame */
     107        and ($conf['LLGBO_SETTINGS'] [0]  == 'true' ) )// frame
     108                 {  $template->append('llgbo', array(
     109                                 'TITLE_FRAME_COLOR' => $conf['LLGBO_FRAME'][0],
     110                                 'TITLE_FRAME' => $current['name'] ), true);
     111                        $template->assign('SHOW_PICTURE_NAME_ON_TITLE' , false);
     112                        }
     113        }
    72114// ---- Metadata ----------     
    73115$pictExt = substr($infofile,-3);
     
    119161// -----------  add CSS tooltip in footer --------------------
    120162//-----------------------------------------------------------------
    121  If ((($conf['LLGBO_SETTINGS'][1]  == 'true' ) /*  tooltip  */ 
     163 If (($conf['LLGBO_SETTINGS'][1]  == 'true' ) /*  tooltip  */ 
    122164 or  ($conf['LLGBO_SETTINGS'] [2]  == 'true' )  /* exif under bt */ )   
    123165        {       $template->append('footer_elements',$sweetcss);
     
    135177} //end --> llgbo_RenderContent
    136178
    137 function LLGBO_prefilter_Frame($content, &$smarty)
    138 {  global $themeconf;
    139 // ------------------------
    140 //  begin frame
    141  $search = '<img src="';
    142   $replacement = '{if isset($llgbo.TITLE_FRAME)}'."\n".'<span  id="llgboh2" style ="background:transparent;z-index:3;color:{$llgbo.TITLE_FRAME_COLOR}">{$llgbo.TITLE_FRAME}</span>';
    143   $replacement = $replacement."\n".'{/if}'."\n".'<div  id="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search;
    144   $content = str_replace($search, $replacement, $content);
    145 // ------------------------
    146   //  End frame 
     179function LLGBO_prefilter_Content_Frame($content, &$smarty)
     180{   //  End frame  picture_content TPL
     181  global $themeconf;
    147182  $search = '{foreach from=$current.unique_derivatives';
    148183  $replacement =  "\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->"."\n".$search;
     
    151186  $replacement =  $search."\n".'{$llgbo.FRAME_END}'."\n"."</div> <!-- end GBO frame -->";}
    152187  return str_replace($search, $replacement, $content);
     188}
     189
     190function LLGBO_prefilter_Picture_Frame($content, &$smarty)
     191{
     192// ------------------------
     193//  begin frame on picture TPL
     194 $search = '{$ELEMENT_CONTENT}';
     195 $replacement = '{if isset($llgbo.TITLE_FRAME)}'."\n".'<span  id="llgboh2" style ="background:transparent;z-index:3;color:{$llgbo.TITLE_FRAME_COLOR}">{$llgbo.TITLE_FRAME}</span>';
     196 $replacement = $replacement."\n".'{/if}'."\n".'<div   id="llgbo0" class="llgbo" {$llgbo.FRAME_SIZE}>'."\n".'{$llgbo.FRAME_BEGIN}'."\n".$search;
     197// ------------------------
     198  return  str_replace($search, $replacement, $content);
    153199}
    154200
Note: See TracChangeset for help on using the changeset viewer.