Changeset 26349 for trunk/themes/smartpocket/themeconf.inc.php
- Timestamp:
- Dec 29, 2013, 10:23:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/themes/smartpocket/themeconf.inc.php
r24928 r26349 23 23 */ 24 24 25 26 class SPThumbPicker 27 { 28 var $candidates; 29 var $default; 30 var $height; 31 32 function init($height) 33 { 34 $this->candidates = array(); 35 foreach( ImageStdParams::get_defined_type_map() as $params) 36 { 37 if ($params->max_height() < $height || $params->sizing->max_crop) 38 continue; 39 if ($params->max_height() > 3*$height) 40 break; 41 $this->candidates[] = $params; 42 } 43 $this->default = ImageStdParams::get_custom($height*3, $height, 1, 0, $height ); 44 $this->height = $height; 45 } 46 47 function pick($src_image) 48 { 49 $ok = false; 50 foreach($this->candidates as $candidate) 51 { 52 $deriv = new DerivativeImage($candidate, $src_image); 53 $size = $deriv->get_size(); 54 if ($size[1]>=$row_height-2) 55 { 56 $ok = true; 57 break; 58 } 59 } 60 if (!$ok) 61 { 62 $deriv = new DerivativeImage($this->default, $src_image); 63 } 64 return $deriv; 65 } 66 } 67 25 68 //Retrive all pictures on thumbnails page 26 69 add_event_handler('loc_index_thumbnails_selection', 'sp_select_all_thumbnails'); … … 31 74 32 75 $template->assign('page_selection', array_flip($selection)); 33 76 $template->assign('thumb_picker', new SPThumbPicker() ); 34 77 return $page['items']; 35 78 } … … 49 92 { 50 93 $screen_size = explode('x', $_COOKIE['screen_size']); 51 $derivative_params = new ImageStdParams; 52 $derivative_params->load_from_db(); 53 54 foreach ($derivative_params->get_all_type_map() as $type => $map) 94 foreach (ImageStdParams::get_all_type_map() as $type => $map) 55 95 { 56 96 if (max($map->sizing->ideal_size) >= max($screen_size) and min($map->sizing->ideal_size) >= min($screen_size))
Note: See TracChangeset
for help on using the changeset viewer.