本文整理匯總了PHP中IO::getThumb方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::getThumb方法的具體用法?PHP IO::getThumb怎麽用?PHP IO::getThumb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IO
的用法示例。
在下文中一共展示了IO::getThumb方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getThumb
public function getThumb($path, $width, $height, $original = false)
{
global $_G;
//$path:可能的值 icoid,'dzz::dzz/201401/02/wrwsdfsdfasdsf.txt'等dzzPath格式;
if (is_numeric($path)) {
$data = C::t('icos')->fetch_by_icoid($path);
$bz = io_remote::getBzByRemoteid($data['remote']);
if ($bz != 'dzz') {
$path = $bz . '/' . $data['attachment'];
IO::getThumb($path, $width, $height, $original, $imgshow);
exit;
}
} else {
if (strpos($path, 'attach::') === 0) {
$data = C::t('attachment')->fetch(intval(str_replace('attach::', '', $path)));
$bz = io_remote::getBzByRemoteid($data['remote']);
if ($bz != 'dzz') {
IO::getThumb($bz . '/' . $data['attachment'], $width, $height, $original);
exit;
}
} elseif (strpos($path, 'dzz::') === 0) {
$data = array('attachment' => str_replace('dzz::', '', $path));
} else {
IO::getThumb($path, $width, $height, $original);
exit;
}
}
$enable_cache = true;
//是否啟用緩存
$quality = 80;
$imgcachePath = 'imgcache/';
$cachepath = str_replace('//', '/', str_replace(':', '/', $data['attachment']));
$imginfo = @getimagesize($_G['setting']['attachdir'] . './' . $data['attachment']);
if ($original) {
@header("Content-Type: " . image_type_to_mime_type($imginfo[2]));
@ob_end_clean();
if (getglobal('gzipcompress')) {
@ob_start('ob_gzhandler');
}
@readfile($_G['setting']['attachdir'] . './' . $data['attachment']);
@flush();
@ob_flush();
exit;
}
if ($imginfo[0] < $width && $imginfo[1] < $height) {
header("Content-Type: " . image_type_to_mime_type($imginfo[2]));
@ob_end_clean();
if (getglobal('gzipcompress')) {
@ob_start('ob_gzhandler');
}
@readfile($_G['setting']['attachdir'] . './' . $data['attachment']);
@flush();
@ob_flush();
exit;
}
$target = $imgcachePath . $cachepath . '.' . $width . '_' . $height . '.jpeg';
if ($enable_cache && @getimagesize($_G['setting']['attachdir'] . $target)) {
header('Content-Type: image/JPEG');
@ob_end_clean();
if (getglobal('gzipcompress')) {
@ob_start('ob_gzhandler');
}
@readfile($_G['setting']['attachdir'] . $target);
@flush();
@ob_flush();
exit;
}
//獲取縮略圖
include_once libfile('class/image');
$target_attach = $_G['setting']['attachdir'] . $target;
$targetpath = dirname($target_attach);
dmkdir($targetpath);
$image = new image();
if ($thumb = $image->Thumb($_G['setting']['attachdir'] . './' . $data['attachment'], $target, $width, $height, 1)) {
header('Content-Type: image/JPEG');
@ob_end_clean();
if (getglobal('gzipcompress')) {
@ob_start('ob_gzhandler');
}
@readfile($_G['setting']['attachdir'] . $target);
@flush();
@ob_flush();
} else {
header("Content-Type: " . image_type_to_mime_type($imginfo[2]));
@ob_end_clean();
if (getglobal('gzipcompress')) {
@ob_start('ob_gzhandler');
}
@readfile($_G['setting']['attachdir'] . './' . $data['attachment']);
@flush();
@ob_flush();
}
exit;
}
示例2: dzzdecode
<?php
/*
* @copyright Leyun internet Technology(Shanghai)Co.,Ltd
* @license http://www.dzzoffice.com/licenses/license.txt
* @package DzzOffice
* @link http://www.dzzoffice.com
* @author zyx(zyx@dzz.cc)
*/
$path = dzzdecode(urldecode($_GET['path']));
$width = intval($_GET['width']);
$height = intval($_GET['height']);
$original = intval($_GET['original']);
IO::getThumb($path, $width, $height, $original);