/** * @copyright 2005-2008 OpenPNE Project * @license http://www.php.net/license/3_01.txt PHP License 3.01 */ function smarty_function_t_img_url($params, &$smarty) { $p = _smarty_function_t_img_url($params); $html = true; if (isset($params['_html'])) { $html = (bool) $params['_html']; unset($params['_html']); } $urlencode = false; if (isset($params['_urlencode'])) { $urlencode = (bool) $params['_urlencode']; unset($params['_urlencode']); } if (OPENPNE_IMG_URL) { $url = OPENPNE_IMG_URL; } else { $url = './'; } if (!OPENPNE_IMG_CACHE_PUBLIC) { $url .= 'img.php'; if ($q = http_build_query($p)) { if ($html) { $url .= '?' . htmlspecialchars($q); } else { $url .= '?' . $q; } } } else { include_once 'OpenPNE/Img.php'; if (!$p['f']) { $parts = explode('.', $p['filename']); $f = array_pop($parts); switch ($f) { case 'jpg': case 'gif': case 'png': $p['f'] = $f; break; default: $p['f'] = 'jpg'; break; } } $path = OpenPNE_Img::get_cache_path($p['filename'], $p['w'], $p['h'], $p['f']); $url .= 'img/' . $path; } if ($urlencode) { $url = urlencode($url); } return $url; }
/** * @copyright 2005-2008 OpenPNE Project * @license http://www.php.net/license/3_01.txt PHP License 3.01 */ function smarty_function_t_img_url_skin($params, &$smarty) { $p = _smarty_function_t_img_url_skin($params); if (OPENPNE_IMG_URL) { $url = OPENPNE_IMG_URL; } else { $url = './'; } if (!($filename = db_get_c_skin_filename4skinname($p['filename']))) { if (strpos($p['filename'], 'skin_') === 0) { $ext = 'jpg'; } else { $ext = 'gif'; } $file = sprintf('skin/%s/img/%s.%s', OPENPNE_SKIN_THEME, $p['filename'], $ext); if (!is_readable(OPENPNE_PUBLIC_HTML_DIR . '/' . $file)) { $file = sprintf('skin/default/img/%s.%s', $p['filename'], $ext); } $url .= $file; } else { if (!OPENPNE_IMG_CACHE_PUBLIC) { $url .= 'img_skin.php'; $p['image_filename'] = $filename; if ($q = http_build_query($p)) { $url .= '?' . htmlspecialchars($q); } } else { $p['filename'] = $filename; include_once 'OpenPNE/Img.php'; if (!$p['f']) { $parts = explode('.', $p['filename']); $f = array_pop($parts); switch ($f) { case 'jpg': case 'gif': case 'png': $p['f'] = $f; break; default: $p['f'] = 'jpg'; break; } } $path = OpenPNE_Img::get_cache_path($p['filename'], $p['w'], $p['h'], $p['f']); $url .= 'img/' . $path; } } return $url; }
defined('OPENPNE_IMG_JPEG_QUALITY') or define('OPENPNE_IMG_JPEG_QUALITY', 75); if (!empty($GLOBALS['_OPENPNE_DSN_LIST']['image']['dsn'])) { $dsn = $GLOBALS['_OPENPNE_DSN_LIST']['image']['dsn']; } else { $dsn = $GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']; } require_once 'OpenPNE/Img.php'; $options = array('dsn' => $dsn, 'cache_dir' => OPENPNE_IMG_CACHE_DIR, 'jpeg_quality' => OPENPNE_IMG_JPEG_QUALITY); if (defined('USE_IMAGEMAGICK')) { switch (USE_IMAGEMAGICK) { case 0: $use_IM = false; break; case 1: $pieces = explode('.', $_GET['filename']); $source_format = OpenPNE_Img::check_format(array_pop($pieces)); $use_IM = $source_format == 'gif'; break; case 2: $use_IM = true; break; default: exit; } } else { $use_IM = false; } if ($use_IM) { require_once 'OpenPNE/Img/ImageMagick.php'; $img =& new OpenPNE_Img_ImageMagick($options); } else {
function OpenPNE_Img_ImageMagick($options = array()) { parent::OpenPNE_Img($options); }