本文整理汇总了PHP中image::close方法的典型用法代码示例。如果您正苦于以下问题:PHP image::close方法的具体用法?PHP image::close怎么用?PHP image::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resizeimg
function resizeimg($folder, $linkanh)
{
global $global_config, $module, $module_name, $module_config;
require_once NV_ROOTDIR . "/includes/class/image.class.php";
$basename = basename($linkanh);
$i = 1;
while (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_config[$module_name]['module'] . '/' . $folder . '/' . $basename)) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . $i . '\\2', $basename);
$i++;
}
$image = new image($linkanh);
$image_info1 = $image->fileinfo;
if ($image_info1['width'] > $module_config[$module_name]['bodyimg']) {
$image->resizeXY($module_config[$module_name]['bodyimg'], NV_MAX_HEIGHT);
}
$thumb_basename = $basename;
$image->save(NV_UPLOADS_REAL_DIR . '/' . $module_config[$module_name]['module'] . '/' . $folder, $thumb_basename);
$image_info = $image->create_Image_info;
$img = str_replace(NV_UPLOADS_REAL_DIR . '/' . $module_config[$module_name]['module'] . '/', '', $image_info['src']);
$image->close();
return $img;
}
示例2: nv_site_theme
$upload = new upload(array('images'), $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);
// Storage in temp dir
$upload_info = $upload->save_file($_FILES['image_file'], NV_ROOTDIR . '/' . NV_TEMP_DIR, false);
// Delete upload tmp
@unlink($_FILES['image_file']['tmp_name']);
if (empty($upload_info['error'])) {
$basename = $upload_info['basename'];
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . nv_genpass(8) . "_" . $user_info['userid'] . '\\2', $basename);
$image = new image($upload_info['name'], NV_MAX_WIDTH, NV_MAX_HEIGHT);
// Resize image, crop image
$image->resizeXY($array['w'], $array['h']);
$image->cropFromLeft($array['x1'], $array['y1'], $array['avatar_width'], $array['avatar_height']);
$image->resizeXY($global_config['avatar_width'], $global_config['avatar_height']);
// Save new image
$image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
$image->close();
if (file_exists($image->create_Image_info['src'])) {
$array['success'] = true;
$array['filename'] = str_replace(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/', '', $image->create_Image_info['src']);
} else {
$array['error'] = $lang_module['avata_error_save'];
}
@nv_deletefile($upload_info['name']);
} else {
$array['error'] = $upload_info['error'];
}
}
}
$contents = nv_avatar($array);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents, false);
示例3: creatThumb
/**
* Back-end create thumbs
* Upload function
**/
function creatThumb($file, $dir, $width, $height = 0)
{
$image = new image($file, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if (empty($height)) {
$image->resizeXY($width, NV_MAX_HEIGHT);
} else {
if ($width * $image->fileinfo['height'] / $image->fileinfo['width'] > $height) {
$image->resizeXY($width, NV_MAX_HEIGHT);
} else {
$image->resizeXY(NV_MAX_WIDTH, $height);
}
$image->cropFromCenter($width, $height);
}
// Kiem tra anh ton tai
$fileName = $width . 'x' . $height . '-' . basename($file);
$fileName2 = $fileName;
$i = 1;
while (file_exists($dir . '/' . $fileName2)) {
$fileName2 = preg_replace('/(.*)(\\.[a-zA-Z0-9]+)$/', '\\1-' . $i . '\\2', $fileName);
++$i;
}
$fileName = $fileName2;
// Luu anh
$image->save($dir, $fileName);
$image->close();
return substr($image->create_Image_info['src'], strlen($dir . '/'));
}
示例4: elseif
$upload_logo = NV_ROOTDIR . '/' . $global_config['site_logo'];
} elseif (file_exists(NV_ROOTDIR . '/images/logo.png')) {
$upload_logo = NV_ROOTDIR . '/images/logo.png';
} else {
die('ERROR#' . $lang_module['notlogo']);
}
$config_logo = array();
$config_logo['x'] = $nv_Request->get_int('x', 'post', 0);
$config_logo['y'] = $nv_Request->get_int('y', 'post', 0);
$config_logo['w'] = $nv_Request->get_int('w', 'post', 0);
$config_logo['h'] = $nv_Request->get_int('h', 'post', 0);
if ($config_logo['w'] > 0 and $config_logo['h'] > 0) {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$createImage = new image(NV_ROOTDIR . '/' . $path . '/' . $file, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$createImage->addlogo($upload_logo, '', '', $config_logo);
$createImage->save(NV_ROOTDIR . '/' . $path, $file);
$createImage->close();
if (isset($array_dirname[$path])) {
if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/(([a-z0-9\\-\\_\\/]+\\/)*([a-z0-9\\-\\_\\.]+)(\\.(gif|jpg|jpeg|png)))$/i', $path . '/' . $file, $m)) {
@nv_deletefile(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $m[1]);
}
$info = nv_getFileInfo($path, $file);
$did = $array_dirname[$path];
$db->query("UPDATE " . NV_UPLOAD_GLOBALTABLE . "_file SET filesize=" . $info['filesize'] . ", src='" . $info['src'] . "', srcwidth=" . $info['srcwidth'] . ", srcheight=" . $info['srcheight'] . ", sizes='" . $info['size'] . "', userid=" . $admin_info['userid'] . ", mtime=" . $info['mtime'] . " WHERE did = " . $did . " AND title = '" . $file . "'");
}
die('OK#' . basename($file));
} else {
die('ERROR#' . $lang_module['notlevel']);
}
}
die('ERROR#Error Access!!');
示例5: createthumb
function createthumb($imgpath, $thumbpath, $filename, $thumbwidth, $thumbheight)
{
global $module_config, $module_name;
if (file_exists($imgpath)) {
require_once NV_ROOTDIR . "/includes/class/image.class.php";
$basename = basename($imgpath);
$image = new image($imgpath, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$thumb_basename = $basename;
$i = 1;
while (file_exists($thumbpath . '/' . $thumb_basename)) {
$thumb_basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . $i . '\\2', $basename);
++$i;
}
$image->resizeXY($thumbwidth, $thumbheight);
$image->save($thumbpath, $thumb_basename);
$image_info = $image->create_Image_info;
$thumb_name = str_replace($thumbpath, '', $image_info['src']);
$image->close();
return $thumb_name;
} else {
return false;
}
}
示例6: nv_get_viewImage
function nv_get_viewImage($fileName)
{
global $array_thumb_config;
if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/(([a-z0-9\\-\\_\\/]+\\/)*([a-z0-9\\-\\_\\.]+)(\\.(gif|jpg|jpeg|png)))$/i', $fileName, $m)) {
$viewFile = NV_FILES_DIR . '/' . $m[1];
if (file_exists(NV_ROOTDIR . '/' . $viewFile)) {
$size = @getimagesize(NV_ROOTDIR . '/' . $viewFile);
return array($viewFile, $size[0], $size[1]);
} else {
$m[2] = rtrim($m[2], '/');
if (isset($array_thumb_config[NV_UPLOADS_DIR . '/' . $m[2]])) {
$thumb_config = $array_thumb_config[NV_UPLOADS_DIR . '/' . $m[2]];
} else {
$thumb_config = $array_thumb_config[''];
$_arr_path = explode('/', NV_UPLOADS_DIR . '/' . $m[2]);
while (sizeof($_arr_path) > 1) {
array_pop($_arr_path);
$_path = implode('/', $_arr_path);
if (isset($array_thumb_config[$_path])) {
$thumb_config = $array_thumb_config[$_path];
break;
}
}
}
$viewDir = NV_FILES_DIR;
if (!empty($m[2])) {
if (!is_dir(NV_ROOTDIR . '/' . $m[2])) {
$e = explode('/', $m[2]);
$cp = NV_FILES_DIR;
foreach ($e as $p) {
if (is_dir(NV_ROOTDIR . '/' . $cp . '/' . $p)) {
$viewDir .= '/' . $p;
} else {
$mk = nv_mkdir(NV_ROOTDIR . '/' . $cp, $p);
if ($mk[0] > 0) {
$viewDir .= '/' . $p;
}
}
$cp .= '/' . $p;
}
}
}
$image = new image(NV_ROOTDIR . '/' . $fileName, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if ($thumb_config['thumb_type'] == 4) {
$thumb_width = $thumb_config['thumb_width'];
$thumb_height = $thumb_config['thumb_height'];
$maxwh = max($thumb_width, $thumb_height);
if ($image->fileinfo['width'] > $image->fileinfo['height']) {
$thumb_config['thumb_width'] = 0;
$thumb_config['thumb_height'] = $maxwh;
} else {
$thumb_config['thumb_width'] = $maxwh;
$thumb_config['thumb_height'] = 0;
}
}
$image->resizeXY($thumb_config['thumb_width'], $thumb_config['thumb_height']);
if ($thumb_config['thumb_type'] == 4) {
$image->cropFromCenter($thumb_width, $thumb_height);
}
$image->save(NV_ROOTDIR . '/' . $viewDir, $m[3] . $m[4], $thumb_config['thumb_quality']);
$create_Image_info = $image->create_Image_info;
$error = $image->error;
$image->close();
if (empty($error)) {
return array($viewDir . '/' . basename($create_Image_info['src']), $create_Image_info['width'], $create_Image_info['height']);
}
}
} else {
$size = @getimagesize(NV_ROOTDIR . '/' . $fileName);
return array($viewFile, $size[0], $size[1]);
}
return false;
}
示例7: nv_get_viewImage
/**
* nv_get_viewImage()
*
* @param mixed $fileName
* @param integer $w
* @param integer $h
* @return
*/
function nv_get_viewImage($fileName, $w = 80, $h = 80)
{
$ext = nv_getextension($fileName);
$md5_view_image = md5($fileName);
$viewDir = NV_FILES_DIR . '/images';
$viewFile = $viewDir . '/' . $md5_view_image . '.' . $ext;
if (file_exists(NV_ROOTDIR . '/' . $viewFile)) {
$size = @getimagesize(NV_ROOTDIR . '/' . $viewFile);
return array($viewFile, $size[0], $size[1]);
}
include_once NV_ROOTDIR . "/includes/class/image.class.php";
$image = new image(NV_ROOTDIR . '/' . $fileName, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$image->resizeXY($w, $h);
$image->save(NV_ROOTDIR . '/' . $viewDir, $md5_view_image, 75);
$create_Image_info = $image->create_Image_info;
$error = $image->error;
$image->close();
if (empty($error)) {
return array($viewDir . '/' . basename($create_Image_info['src']), $create_Image_info['width'], $create_Image_info['height']);
}
return false;
}