⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thumbs.php

📁 eGroupWare is a multi-user, web-based groupware suite developed on a custom set of PHP-based APIs. C
💻 PHP
字号:
<?php /************************************************************************* Title.........:	Thumbnail generator, with cache.** Version.......:	1.0** Author........:	Xiang Wei ZHUO <wei@zhuo.org>** Filename......:	thumbs.php** Last changed..:	1 Mar 2003 ** Notes.........:	Configuration in config.inc.php                    - if the thumbnail does not exists or the source					  file is newer, create a new thumbnail.***********************************************************************/include 'config.inc.php';require_once '../ImageEditor/Transform.php';$img = $BASE_DIR.urldecode($_GET['img']);if(is_file($img)) {	make_thumbs(urldecode($_GET['img']));}function make_thumbs($img) {	global $BASE_DIR, $BASE_URL;	$path_info = pathinfo($img);	$path = $path_info['dirname']."/";	$img_file = $path_info['basename'];	$thumb = $path.'.'.$img_file;	$img_info = getimagesize($BASE_DIR.$path.$img_file);	$w = $img_info[0]; $h = $img_info[1];		$nw = 96; $nh = 96;	if($w <= $nw && $h <= $nh) {		header('Location: '.$BASE_URL.$path.$img_file);		exit();			}	if(is_file($BASE_DIR.$thumb)) {		$t_mtime = filemtime($BASE_DIR.$thumb);		$o_mtime = filemtime($BASE_DIR.$img);		if($t_mtime > $o_mtime) {			//echo $BASE_URL.$path.'.'.$img_file;			header('Location: '.$BASE_URL.$path.'.'.$img_file);			exit();				}	}	$img_thumbs = Image_Transform::factory(IMAGE_CLASS);	$img_thumbs->load($BASE_DIR.$path.$img_file);	if ($w > $h)          $nh = unpercent(percent($nw, $w), $h);              else if ($h > $w)          $nw = unpercent(percent($nh, $h), $w); 	$img_thumbs->resize($nw, $nh);	$img_thumbs->save($BASE_DIR.$thumb);	$img_thumbs->free();	chmod($BASE_DIR.$thumb, 0666);	if(is_file($BASE_DIR.$thumb)) {		//echo "Made:".$BASE_URL.$path.'.'.$img_file;		header('Location: '.$BASE_URL.$path.'.'.$img_file);		exit();	}}function percent($p, $w)     {     return (real)(100 * ($p / $w));     } function unpercent($percent, $whole)     {     return (real)(($percent * $whole) / 100);     } ?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -