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

📄 function_picture.inc

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 INC
字号:
<?php

function createjpeg( $source_src, $picname, $des, $dst_width = "100", $dst_height = "100" )
{
	$newpicname = $picname;
	$destination = $_SERVER['DOCUMENT_ROOT']."cache/album/".$_SESSION['LOGIN_USER_ID'];
	if ( !is_dir( $destination ) )
	{
		mkdir( $destination, 511 );
	}
	$destination = $_SERVER['DOCUMENT_ROOT']."cache/album/".$_SESSION['LOGIN_USER_ID']."/".$des;
	if ( !is_dir( $destination ) )
	{
		mkdir( $destination, 511 );
	}
	$destination = $_SERVER['DOCUMENT_ROOT']."cache/album/".$_SESSION['LOGIN_USER_ID']."/".$des.$newpicname;
	$source_src = $source_src;
	$dst_x = 0;
	$dst_y = 0;
	$src_x = 0;
	$src_y = 0;
	$im_src = @imagecreatefrompic( $source_src );
	$im_width = imagesx( $im_src );
	$im_height = imagesy( $im_src );
	if ( 0 < $dst_width && $dst_height < 1 )
	{
		$im_width = imagesx( $im_src );
		$new_width = $dst_width;
		$new_height = floor( $new_width / $im_width * imagesy( $im_src ) );
	}
	if ( 0 < $dst_height && $dst_width < 1 )
	{
		$im_height = imagesy( $im_src );
		$new_height = $dst_height;
		$new_width = floor( $new_height / $im_height * imagesx( $im_src ) );
	}
	if ( 0 < $dst_height && 0 < $dst_width )
	{
		$new_height = $dst_height;
		$new_width = $dst_width;
	}
	$reimgscr = str_replace( ROOT_PATH, ROOT_URL, $destination );
	if ( is_file( $destination ) )
	{
		$im_src_have = @imagecreatefrompic( $destination );
		if ( $new_width == imagesx( $im_src_have ) && $new_height == imagesy( $im_src_have ) )
		{
			return $reimgscr;
		}
	}
	$im = imagecreatetruecolor( $new_width, $new_height );
	imagecopyresized( $im, $im_src, 0, 0, 0, 0, $new_width, $new_height, $im_width, $im_height );
	imagepic( $im, $destination, 85 );
	imagedestroy( $im );
	return $reimgscr;
}

function imagecreatefrompic( $source_src )
{
	$suffix = getfilesuffix( $source_src );
	switch ( $suffix )
	{
	case "jpg" :
		$im = @imagecreatefromjpeg( $source_src );
		break;
	case "jpeg" :
		$im = @imagecreatefromjpeg( $source_src );
		break;
	case "gif" :
		$im = @imagecreatefromgif( $source_src );
		break;
	case "png" :
		$im = @imagecreatefrompng( $source_src );
		break;
	default :
		$im = @imagecreatefromjpeg( $source_src );
	}
	return $im;
}

function imagepic( $im, $destination, $quality = "85" )
{
	$suffix = getfilesuffix( $destination );
	switch ( $suffix )
	{
	case "jpg" :
		@imagejpeg( $im, $destination, $quality );
		break;
	case "jpeg" :
		@imagejpeg( $im, $destination, $quality );
		break;
	case "gif" :
		@imagegif( $im, $destination );
		break;
	case "png" :
		@imagepng( $im, $destination );
		break;
	default :
		@imagejpeg( $im, $destination, $quality );
	}
}

function dirsize( $dir )
{
	@$dh = @opendir( $dir );
	$size = 0;
	while ( $file = @readdir( $dh ) )
	{
		if ( $file != "." && $file != ".." )
		{
			$path = $dir."/".$file;
			if ( is_dir( $path ) )
			{
				$size += dirsize( $path );
			}
			else if ( is_file( $path ) )
			{
				$size += filesize( $path );
			}
		}
	}
	@closedir( $dh );
	return $size;
}

?>

⌨️ 快捷键说明

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