Changeset 13021 for trunk/include/template.class.php
- Timestamp:
- Feb 2, 2012, 9:59:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r12955 r13021 560 560 !empty($params['height']) or fatal_error('define_derviative missing height'); 561 561 562 $derivative = new DerivativeParams( SizingParams::classic( intval($params['width']), intval($params['height'])) ); 562 $w = intval($params['width']); 563 $h = intval($params['height']); 564 $crop = 0; 565 $minw=null; 566 $minh=null; 567 563 568 if (isset($params['crop'])) 564 569 { 565 570 if (is_bool($params['crop'])) 566 571 { 567 $ derivative->sizing->max_crop = $params['crop'] ? 1:0;572 $crop = $params['crop'] ? 1:0; 568 573 } 569 574 else 570 575 { 571 $derivative->sizing->max_crop = round($params['crop']/100, 2); 572 } 573 574 if ($derivative->sizing->max_crop) 575 { 576 $minw = empty($params['min_width']) ? $derivative->max_width() : intval($params['min_width']); 577 $minw <= $derivative->max_width() or fatal_error('define_derviative invalid min_width'); 578 $minh = empty($params['min_height']) ? $derivative->max_height() : intval($params['min_height']); 579 $minh <= $derivative->max_height() or fatal_error('define_derviative invalid min_height'); 580 581 $derivative->sizing->min_size = array($minw, $minh); 582 } 583 } 584 585 ImageStdParams::apply_global($derivative); 586 $smarty->assign( $params['name'], $derivative); 576 $crop = round($params['crop']/100, 2); 577 } 578 579 if ($crop) 580 { 581 $minw = empty($params['min_width']) ? $w : intval($params['min_width']); 582 $minw <= $w or fatal_error('define_derviative invalid min_width'); 583 $minh = empty($params['min_height']) ? $h : intval($params['min_height']); 584 $minh <= $h or fatal_error('define_derviative invalid min_height'); 585 } 586 } 587 588 $smarty->assign( $params['name'], ImageStdParams::get_custom($w, $h, $crop, $minw, $minh) ); 587 589 } 588 590
Note: See TracChangeset
for help on using the changeset viewer.