function smarty_function_mtassetthumbnaillink($args, &$ctx) { $asset = $ctx->stash('asset'); if (!$asset) { return ''; } if ($asset->asset_class != 'image') { return ''; } $blog = $ctx->stash('blog'); if (!$blog) { return ''; } require_once 'MTUtil.php'; list($thumb, $thumb_w, $thumb_h) = get_thumbnail_file($asset, $blog, $args); if (empty($thumb)) { return ''; } $target = ""; if (isset($args['new_window'])) { $target = " target=\"_blank\""; } $asset_url = smarty_function_mtasseturl($args, $ctx); return sprintf("<a href=\"%s\"%s><img src=\"%s\" width=\"%d\" height=\"%d\" alt=\"\" /></a>", $asset_url, $target, $thumb, $thumb_w, $thumb_h); }
function smarty_function_mtassetthumbnailurl($args, &$ctx) { $asset = $ctx->stash('asset'); if (!$asset) { return ''; } if ($asset->asset_class != 'image') { return ''; } $blog = $ctx->stash('blog'); if (!$blog) { return ''; } require_once 'MTUtil.php'; list($thumb) = get_thumbnail_file($asset, $blog, $args); return $thumb; }
} if (empty($thumbfile)) { $thumbfile = 'img/trans.png'; } if (!empty($thumbfile)) { $smarty->assign('thumbfile', $thumbfile); } if ($prefs['feature_jquery'] == 'y') { // hash of themes and their options and their thumbnail images $js = 'var style_options = {'; foreach ($styles as $s) { $js .= "\n'{$s}':['" . get_thumbnail_file($s, '') . '\',{'; $options = $tikilib->list_style_options($s); if ($options) { foreach ($options as $o) { $js .= "'{$o}':'" . get_thumbnail_file($s, $o) . '\','; } $js = substr($js, 0, strlen($js) - 1) . '}'; } else { $js .= '}'; } $js .= '],'; } $js = substr($js, 0, strlen($js) - 1); $js .= '};'; // JS to handle theme/option changes client-side // the var (style_options) has to be declared in the same block for AJAX call scope $none = json_encode(tr('None')); $headerlib->add_js(<<<JS {$js}