diff options
| author | Nathan Kinkade <nath@nkinka.de> | 2012-02-08 16:05:35 +0000 |
|---|---|---|
| committer | Nathan Kinkade <nath@nkinka.de> | 2012-02-08 16:05:35 +0000 |
| commit | 2f9824f239410088ef3436f8eaf98cfaf914210f (patch) | |
| tree | 9bca0469f705605cc96039c6d8d10eafe04993db | |
| parent | 72d9d2be7091333facb8459d87c7db77b4d9c9bb (diff) | |
Added a new maxsize parameter, and also slightly reconfiged syntax of height and width assignment.
| -rw-r--r-- | views/randimg.html.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/views/randimg.html.php b/views/randimg.html.php index 2653cc9..b86420a 100644 --- a/views/randimg.html.php +++ b/views/randimg.html.php @@ -27,11 +27,18 @@ if ( ! empty($item) ) { $thumb_url = $item->thumb_url(true); } - $width = Input::instance()->get("width"); - $width = $width ? "width: {$width}px;" : ""; + if ( $width = Input::instance()->get("width") ) { + $dimensions = "width: {$width}px;"; + } + + if ( $height = Input::instance()->get("height") ) { + $dimensions .= "height: {$height}px;"; + } - $height = Input::instance()->get("height"); - $height = $height ? "height: {$height}px;" : ""; + if ( $maxsize = Input::instance()->get("maxsize") ) { + $dimensions = ( $item->width > $item->height ) ? + "width: {$maxsize}px;" : "height: {$maxsize}px;"; + } $target = Input::instance()->get("target"); $target = $target ? "target=\"$target\"" : ""; @@ -39,7 +46,7 @@ if ( ! empty($item) ) { echo <<<HTML <div class="g-randimg"> <a href="http://$g3path/$link_path" title="$img_title" $target> - <img src="$thumb_url" style="border: thin solid black; $width; $height" alt="$img_title" /> + <img src="$thumb_url" style="border: thin solid black; $dimensions" alt="$img_title" /> </a> </div> HTML; |
