Changeset 17192 for extensions/Autosize/autosize.inc.php
- Timestamp:
- Jul 28, 2012, 8:48:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/autosize.inc.php
r16931 r17192 27 27 static public function cl_autosize_script_1() 28 28 { 29 global $template,$user,$conf,$picture ,$page, $cl_plugin ; 30 29 global $user,$page,$template,$cl_plugin; 30 31 31 32 // header ('X-UA-Compatible: n=7') ; 32 33 // header ('X-UA-Compatible: IE=Edge') ; … … 58 59 'AUTOSIZE_PATH' => str_replace("../","",AUTOSIZE_PATH) , 59 60 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS, 60 'Version_pwg' => PHPWG_VERSION 61 'Version_pwg' => PHPWG_VERSION , 62 'loading' => AUTOSIZE_PATH . 'images/loading.gif' 61 63 ) 62 64 ); … … 71 73 { 72 74 global $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ; 75 76 global $template,$user,$conf,$picture ,$page, $cl_plugin ; 77 73 78 if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; 74 79 if (!isset($PAMOORAMICS_PATH)) return ; 75 80 $AUTOSIZE_PATH = dirname(__FILE__).'/'; 76 81 //================================================================ … … 155 160 156 161 // this is the default handler that generates the display for the element 157 static public function autosize_ RenderContent($content, $element_info)162 static public function autosize_calcContent($content) 158 163 { 159 global $conf; 160 if ( !empty($content) ) 161 {// someone hooked us - so we skip; 162 return $content; 163 } 164 if (isset($_COOKIE['picture_deriv'])) 165 { 166 if ( array_key_exists($_COOKIE['picture_deriv'], ImageStdParams::get_defined_type_map()) ) 167 { 168 pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']); 164 global $conf; 165 166 global $page, $template,$picture; 167 168 169 $current = $template->get_template_vars('current'); 170 $defined_types = array_keys(ImageStdParams::get_defined_type_map()); 171 if (isset($current)){ 172 if (!isset($current['selected_derivative'])){ 173 $model= $defined_types[count($defined_types)-1]; 174 $selected_derivative = $current['derivatives'][$model]; 175 $template->append('current', array( 176 'selected_derivative' => $selected_derivative 177 ), true); 178 179 180 $current = $template->get_template_vars('current'); 181 } 182 183 $derivative=$current['selected_derivative'] ; 184 $imgScaledWH=$derivative->src_image->get_size(); 185 $imgSizeWH = $derivative->get_size(); 186 $img_type = $derivative->get_type(); 187 $img_url = $derivative->get_url(); 188 $img_all= $derivative->get_all($derivative->src_image); 189 $scaled_size=$derivative->get_size_hr(); //792 x 441 190 $scaled_size=$derivative->get_scaled_size_htm(); // width="792" height="441" 191 //================= taille mis a l'échelle 192 $scaled_size=$derivative->get_scaled_size(100,100); // array([0]=>100,[1]=>55) 193 $src= $derivative->src_image ; 194 169 195 } 170 setcookie('picture_deriv', false, 0, cookie_path() ); 171 } 172 $deriv_type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']); 173 $selected_derivative = $element_info['derivatives'][$deriv_type]; 174 175 $unique_derivatives = array(); 176 $show_original = isset($element_info['element_url']); 177 $added = array(); 178 foreach($element_info['derivatives'] as $type => $derivative) 179 $element_info['derivatives']['Autosize']=$derivative; // last 180 181 foreach($element_info['derivatives'] as $type => $derivative) { 182 if ($type=='Autosize'){ 183 184 $url = $derivative->get_url(); 185 if (isset($added[$url])) 186 continue; 187 $added[$url] = 1; 188 $show_original &= !($derivative->same_as_source()); 189 $unique_derivatives[$type]= $derivative; 190 } 191 192 } 193 194 global $page, $template; 195 196 if ($show_original) 197 { 198 $template->assign( 'U_ORIGINAL', $element_info['element_url'] ); 199 } 200 201 $template->append('current', array( 202 'selected_derivative' => $selected_derivative, 203 'unique_derivatives' => $unique_derivatives, 204 ), true); 205 $file =AUTOSIZE_PATH_ABS.'template/picture_content.tpl' ; 206 $template->set_filenames( 207 array('autosize_content'=> $file) 208 ); 209 210 $template->assign( array( 211 'ALT_IMG' => $element_info['file'], 212 'COOKIE_PATH' => cookie_path(), 213 ) 214 ); 215 return $template->parse( 'autosize_content', false); 196 197 $img_scaled_width=isset($imgScaledWH)?$imgScaledWH[0]:"480"; 198 $img_scaled_height=isset($imgScaledWH)?$imgScaledWH[1]:"320"; 199 $current = $template->get_template_vars('picture'); 200 $picture['current']['scaled_width']=$img_scaled_width; 201 $picture['current']['scaled_height']= $img_scaled_height; 202 $picture['current']['image_url']=$src->rel_path; 203 216 204 } 217 205 … … 228 216 if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ; 229 217 load_language('plugin.lang', AUTOSIZE_PATH); 218 230 219 $AUTOSIZE_PATH = dirname(__FILE__).'/'; 231 220 if (isset( $page['body_id']) && $page['body_id']=='thePicturePage' ) { … … 271 260 $template->parse('mes_script'); 272 261 } 273 262 274 263 return $template->parse( 'autosize_content', false); 275 264 }
Note: See TracChangeset
for help on using the changeset viewer.