我网上dede里面的类
如下 ,下面用到那个系统函数需要服务器打开才支持的。
本地是好的,上传到服务器就不显示。到底可能少了什么没开。function ImageResizeNew($srcFile, $toW, $toH, $toFile='', $issave=true)
{
global $cfg_photo_type, $cfg_ddimg_bgcolor;
if($toFile=='') $toFile = $srcFile;
$info = '';
$srcInfo = GetImageSize($srcFile,$info);
switch ($srcInfo[2])
{
case 1:
if(!$cfg_photo_type['gif']) return false;
$img = imagecreatefromgif($srcFile);
break;
case 2:
if(!$cfg_photo_type['jpeg']) return false;
$img = imagecreatefromjpeg($srcFile);
break;
case 3:
if(!$cfg_photo_type['png']) return false;
$img = imagecreatefrompng($srcFile);
break;
case 6:
if(!$cfg_photo_type['bmp']) return false;
$img = imagecreatefromwbmp($srcFile);
break;
} $width = imageSX($img);
$height = imageSY($img); if (!$width || !$height) {
return false;
} $target_width = $toW;
$target_height = $toH;
$target_ratio = $target_width / $target_height; $img_ratio = $width / $height; if ($target_ratio > $img_ratio) {
$new_height = $target_height;
$new_width = $img_ratio * $target_height;
} else {
$new_height = $target_width / $img_ratio;
$new_width = $target_width;
} if ($new_height > $target_height) {
$new_height = $target_height;
}
if ($new_width > $target_width) {
$new_height = $target_width;
} $new_img = ImageCreateTrueColor($target_width, $target_height);
if($cfg_ddimg_bgcolor==0) $bgcolor = ImageColorAllocate($new_img, 0xff, 0xff, 0xff);
else $bgcolor = 0;
if (!@imagefilledrectangle($new_img, 0, 0, $target_width-1, $target_height-1, $bgcolor))
{
return false;
} if (!@imagecopyresampled($new_img, $img, ($target_width-$new_width)/2, ($target_height-$new_height)/2, 0, 0, $new_width, $new_height, $width, $height))
{
return false;
}
//保存为目标文件
if($issave)
{
switch ($srcInfo[2])
{
case 1:
imagegif($new_img, $toFile);
break;
case 2:
imagejpeg($new_img, $toFile,100);
break;
case 3:
imagepng($new_img, $toFile);
break;
case 6:
imagebmp($new_img, $toFile);
break;
default:
return false;
}
}
//不保存
else
{
switch ($srcInfo[2])
{
case 1:
imagegif($new_img);
break;
case 2:
imagejpeg($new_img);
break;
case 3:
imagepng($new_img);
break;
case 6:
imagebmp($new_img);
break;
default:
return false;
}
}
imagedestroy($new_img);
imagedestroy($img);
return true;
} //生成缩略图
ob_start();
ImageResizeNew($cfg_basedir.$img, $cfg_ddimg_width, $cfg_ddimg_height, '', false);
$imagevariable = ob_get_contents();
ob_end_clean();
header('Content-type: image/jpeg');
header('Content-Length: '.strlen($imagevariable));
echo $imagevariable; //这里是显示图片,服务器不显示图片出来而是打叉。
exit();谢谢!
解决方案 »
- /\d000/ 这个不能匹配 1111对? 000是什么意思?
- 关于JS关闭窗口...
- 求一个正则表达式(在线急等)
- 数字0.4449 为什么 echo出来是.4449。能不能用什么函数变成 0.4449。望告知。
- 求一分割字符的方法
- 实在是搞不定呀!100分向各位大虾求救!在线焦急等待apache2+php4安装问题
- 我也不知道是什么问题啦~~烦四了~~(关于Mcrypt)
- 以前我看到,不知是谁的做的一个php mysql程序,下载安装后,就能访问运行了,这是怎么做出来的呢?
- php连接MSSQL问题
- ●●●●●●LeeMaRS(小菜虎_水壶的仇人):你进来!●●●●●●
- php + javascript 验证验证码
- 请教一个网络抓包软件。。
网站有写入权限
也可以发布图片上面那个是取图片输出缩略图意思吧!并没有把图片保存下来。
现在输出图片有问题。本地用wamp服务器没有问题。放到2003+iis+php上就不显示图片。怪了
没有把这个图片保存。
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
uft8不能用记事本写。唉!
给分给大家