Changeset 25746 for trunk/include
- Timestamp:
- Nov 28, 2013, 10:10:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_monthly.class.php
r25507 r25746 420 420 421 421 list($cell_width, $cell_height) = ImageStdParams::get_by_type(IMG_SQUARE)->sizing->ideal_size; 422 if ($cell_width>120)423 {424 $cell_width = $cell_height = 120;425 }426 422 427 423 $tpl_weeks = array(); … … 456 452 else 457 453 { 458 list($tn_width,$tn_height) = $items[$day]['derivative']->get_size();459 460 // now need to fit the thumbnail of size tn_size within461 // a cell of size cell_size by playing with CSS position (left/top)462 // and the width and height of <img>.463 $ratio_w = $tn_width/$cell_width;464 $ratio_h = $tn_height/$cell_height;465 466 $pos_top=$pos_left=0;467 $css_style = '';468 469 if ( $ratio_w>1 and $ratio_h>1)470 {// cell completely smaller than the thumbnail so we will let the browser471 // resize the thumbnail472 if ($ratio_w > $ratio_h )473 {// thumbnail ratio compared to cell -> wide format474 $css_style = 'height:'.$cell_height.'px;';475 $browser_img_width = $cell_height*$tn_width/$tn_height;476 $pos_left = ($browser_img_width-$cell_width)/2;477 }478 else479 {480 $css_style = 'width:'.$cell_width.'px;';481 $browser_img_height = $cell_width*$tn_height/$tn_width;482 $pos_top = ($browser_img_height-$cell_height)/2;483 }484 }485 else486 {487 $pos_left = ($tn_width-$cell_width)/2;488 $pos_top = ($tn_height-$cell_height)/2;489 }490 491 if ( round($pos_left)!=0)492 {493 $css_style.='left:'.round(-$pos_left).'px;';494 }495 if ( round($pos_top)!=0)496 {497 $css_style.='top:'.round(-$pos_top).'px;';498 }499 454 $url = duplicate_index_url( 500 455 array( … … 515 470 'IMAGE' => $items[$day]['derivative']->get_url(), 516 471 'U_IMG_LINK' => $url, 517 'IMAGE_STYLE' => $css_style,518 472 'IMAGE_ALT' => $items[$day]['file'], 519 473 );
Note: See TracChangeset
for help on using the changeset viewer.