コード例 #1
0
ファイル: image.php プロジェクト: ranrolls/ras-full-portal
 private static function getSizeByAuto($newWidth, $newHeight, $width, $height)
 {
     if ($height < $width) {
         $optimalWidth = $newWidth;
         $optimalHeight = lnpResizeImageHelper::getSizeByFixedWidth($newWidth, $width, $height);
     } elseif ($height > $width) {
         $optimalWidth = lnpResizeImageHelper::getSizeByFixedHeight($newHeight, $width, $height);
         $optimalHeight = $newHeight;
     } else {
         if ($newHeight < $newWidth) {
             $optimalWidth = $newWidth;
             $optimalHeight = lnpResizeImageHelper::getSizeByFixedWidth($newWidth, $width, $height);
         } else {
             if ($newHeight > $newWidth) {
                 $optimalWidth = lnpResizeImageHelper::getSizeByFixedHeight($newHeight, $width, $height);
                 $optimalHeight = $newHeight;
             } else {
                 //Sqaure being resized to a square
                 $optimalWidth = $newWidth;
                 $optimalHeight = $newHeight;
             }
         }
     }
     return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
 }
コード例 #2
0
ファイル: default.php プロジェクト: ranrolls/ras-full-portal
                ?>
" title="<?php 
                echo $item->imgtitle;
                ?>
" style="height:<?php 
                echo $thumb_height;
                ?>
px;width:<?php 
                echo $thumb_width;
                ?>
px" />
			<?php 
            } elseif (empty($images->image_intro) && empty($images->image_fulltext) && $item->image !== "0") {
                ?>
				<img src="<?php 
                echo lnpResizeImageHelper::getResizedImage('/' . $item->image, $thumb_width, $thumb_height, 'crop');
                ?>
" alt="<?php 
                echo $item->imgalt;
                ?>
" title="<?php 
                echo $item->imgtitle;
                ?>
" style="height:<?php 
                echo $thumb_height;
                ?>
px;width:<?php 
                echo $thumb_width;
                ?>
px" />
			<?php