diff options
Diffstat (limited to 'views/randimg.html.php')
| -rw-r--r-- | views/randimg.html.php | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/views/randimg.html.php b/views/randimg.html.php index 52d4d78..59817a6 100644 --- a/views/randimg.html.php +++ b/views/randimg.html.php @@ -1,21 +1,41 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <?php -/** - * In some cases the proper URL path to the images on the disc - * will be virtualized via an Apache Alias definition, so grab - * that path here. - */ -$virtpath = $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']); +if ( ! empty($item) ) { -// URL to Gallery3 -$g3path = "{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}"; + /** + * In some cases the proper URL path to the images on the disc + * will be virtualized via an Apache Alias definition, so grab + * that path here. + */ + $virtpath = $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']); -echo <<<HTML -<a href="http://$g3path/$linkpath" title="$img_title"> - <img src="http://$virtpath/var/resizes/$imgpath" style="border: thin solid black;" alt="$img_title" /> -</a> + // URL to Gallery3 + $g3path = "{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}"; + $link_path = $item->relative_url(); + $img_title = $item->title; + switch (Input::instance()->get("size")) { + case "fullsize": + $thumb_url = $item->file_url(true); + break; + case "resize": + $thumb_url = $item->resize_url(true); + break; + case "thumb": + default: + $thumb_url = $item->thumb_url(true); + } + + $width = Input::instance()->get("width"); + $width = $width ? "width: {$width}px;" : ""; + + echo <<<HTML +<div class="g-randimg" style="$width"> + <a href="http://$g3path/$link_path" title="$img_title"> + <img src="$thumb_url" style="border: thin solid black;" alt="$img_title" /> + </a> +</div> HTML; -?> +} |
