Changeset 12796 for trunk/picture.php
- Timestamp:
- Dec 27, 2011, 6:26:44 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/picture.php
r12767 r12796 22 22 // +-----------------------------------------------------------------------+ 23 23 24 define('PHPWG_ROOT_PATH',' ./');24 define('PHPWG_ROOT_PATH',''); 25 25 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 26 26 include(PHPWG_ROOT_PATH.'include/section_init.inc.php'); … … 154 154 return $content; 155 155 } 156 if (!isset($element_info['image_url'])) 157 { // nothing to do 158 return $content; 156 157 if (isset($_COOKIE['picture_deriv'])) 158 { 159 pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']); 160 setcookie('picture_deriv', false, 0); 161 } 162 $deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE); 163 $selected_derivative = $element_info['derivatives'][$deriv_type]; 164 165 $available_derivatives = array(); 166 $added = array(); 167 foreach($element_info['derivatives'] as $type => $derivative) 168 { 169 $url = $derivative->get_url(); 170 if (isset($added[$url])) 171 continue; 172 $added[$url] = 1; 173 $available_derivatives[] = $type; 159 174 } 160 175 161 176 global $user, $page, $template; 177 178 $template->append('current', array( 179 'selected_derivative' => $selected_derivative, 180 'available_derivative_types' => $available_derivatives, 181 ), true); 182 162 183 163 184 $template->set_filenames( … … 165 186 ); 166 187 167 if ( !$page['slideshow'] and isset($element_info['high_url']) )168 {169 $uuid = uniqid(rand());170 $template->assign(171 'high',172 array(173 'U_HIGH' => $element_info['high_url'],174 'UUID' => $uuid,175 )176 );177 }178 188 $template->assign( array( 179 'SRC_IMG' => $element_info['image_url'],180 189 'ALT_IMG' => $element_info['file'], 181 'WIDTH_IMG' => @$element_info['scaled_width'],182 'HEIGHT_IMG' => @$element_info['scaled_height'],183 190 ) 184 191 ); … … 404 411 } 405 412 406 // incrementation of the number of hits, we do this only if no action413 //---------- incrementation of the number of hits, we do this only if no action 407 414 if (trigger_event('allow_increment_element_hit_count', !isset($_POST['content']) ) ) 408 415 { … … 493 500 } 494 501 502 $picture[$i]['derivatives'] = DerivativeImage::get_all($row); 503 $picture[$i]['src_image'] = $picture[$i]['derivatives'][IMG_THUMB]->src_image; 504 $picture[$i]['thumbnail'] = $picture[$i]['derivatives'][IMG_THUMB]->get_url(); 505 495 506 // ------ build element_path and element_url 496 507 $picture[$i]['element_path'] = get_element_path($picture[$i]); … … 510 521 if ( $user['enabled_high']=='true' ) 511 522 { 512 $hi_url=get_high_url($picture[$i]); 513 if ( !empty($hi_url) ) 514 { 515 $picture[$i]['high_url'] = $hi_url; 516 $picture[$i]['download_url'] = get_download_url('h',$picture[$i]); 517 } 523 $picture[$i]['download_url'] = get_download_url('e',$picture[$i]); 518 524 } 519 525 } … … 524 530 } 525 531 526 $picture[$i]['thumbnail'] = get_thumbnail_url($row);527 532 528 533 if ( !empty( $row['name'] ) ) … … 567 572 $picture['current']['height']= $taille_image[1]; 568 573 } 569 }570 571 if (!empty($picture['current']['width']))572 {573 list(574 $picture['current']['scaled_width'],575 $picture['current']['scaled_height']576 ) = get_picture_size(577 $picture['current']['width'],578 $picture['current']['height'],579 @$user['maxwidth'],580 @$user['maxheight']581 );582 574 } 583 575 … … 897 889 898 890 // size in pixels 899 if ($picture['current']['is_picture'] AND $picture['current']['has_high']) 900 { 901 if (!empty($picture['current']['high_width'])) 902 { 903 $infos['INFO_DIMENSIONS'] = $picture['current']['high_width'].'*'.$picture['current']['high_height']; 904 } 905 else if ($hi_size = @getimagesize($hi_url)) 906 { 907 pwg_query(' 908 UPDATE ' . IMAGES_TABLE . ' 909 SET 910 high_width = \'' . $hi_size[0].'\', 911 high_height = \''.$hi_size[1] .'\' 912 WHERE id = ' . $picture['current']['id'] . '; 913 '); 914 915 $infos['INFO_DIMENSIONS'] = $hi_size[0].'*'.$hi_size[1]; 916 } 917 } 918 else if ($picture['current']['is_picture'] and isset($picture['current']['width']) ) 919 { 920 if ($picture['current']['scaled_width'] !== $picture['current']['width'] ) 921 { 922 $infos['INFO_DIMENSIONS'] = 923 '<a href="'.$picture['current']['image_url'].'" title="'. 924 l10n('Original dimensions').'">'. 925 $picture['current']['width'].'*'.$picture['current']['height'].'</a>'; 926 } 927 else 928 { 929 $infos['INFO_DIMENSIONS'] = 930 $picture['current']['width'].'*'.$picture['current']['height']; 931 } 891 if ($picture['current']['is_picture'] and isset($picture['current']['width']) ) 892 { 893 $infos['INFO_DIMENSIONS'] = 894 $picture['current']['width'].'*'.$picture['current']['height']; 932 895 } 933 896 934 897 // filesize 935 if ($picture['current']['has_high'] and !empty($picture['current']['high_filesize'])) 936 { 937 $infos['INFO_FILESIZE'] = 938 sprintf(l10n('%d Kb'), $picture['current']['high_filesize']); 939 } 940 else if (!empty($picture['current']['filesize'])) 898 if (!empty($picture['current']['filesize'])) 941 899 { 942 900 $infos['INFO_FILESIZE'] =
Note: See TracChangeset
for help on using the changeset viewer.