求帮忙看下这段php生成缩略图的代码为什么不成功
<?php$filename="des_big.jpg";$src_image=imagecreatefromjpeg($filename);list($src_w,$s...
<?php
$filename="des_big.jpg";
$src_image=imagecreatefromjpeg($filename);
list($src_w,$src_h)=getimagesize($filename);//取出源图像的宽高
echo $src_w;
$scale=0.5;//缩放比例
$dst_w=ceil($src_w*$scale);//宽乘上缩放比例并取整
$dst_h=ceil($src_h*$scale);
$dst_image=imagecreatetruecolor($dst_w,$dst_h);//创建画布
imagecopyresampled($dst_image,$src_image,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
header("content-type:image/jpeg");
imagejpeg($dst_image);
imagedestroy($src_image);
imagedestroy($dst_image); 展开
$filename="des_big.jpg";
$src_image=imagecreatefromjpeg($filename);
list($src_w,$src_h)=getimagesize($filename);//取出源图像的宽高
echo $src_w;
$scale=0.5;//缩放比例
$dst_w=ceil($src_w*$scale);//宽乘上缩放比例并取整
$dst_h=ceil($src_h*$scale);
$dst_image=imagecreatetruecolor($dst_w,$dst_h);//创建画布
imagecopyresampled($dst_image,$src_image,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
header("content-type:image/jpeg");
imagejpeg($dst_image);
imagedestroy($src_image);
imagedestroy($dst_image); 展开
展开全部
<?php
echo ' web-root = '.$_SERVER['DOCUMENT_ROOT'].'<br>';
echo ' current-file = '.__FILE__.'<br>';
echo ' current-dir = '.dirname(__FILE__).'<br>';
echo ' http-root = '.$_SERVER['HTTP_HOST'].'<br>';
echo ' web-position = '.$_SERVER['PHP_SELF'].'<br>';
$file='c:/webroot/index.php';
echo ' file-position = '.$file.'<br>';
$fileWebAddress='http://'.str_replace($_SERVER['DOCUMENT_ROOT'],$_SERVER['HTTP_HOST'],$file);
echo ' file-web-position = '.$fileWebAddress.'<br>';
?>
echo ' web-root = '.$_SERVER['DOCUMENT_ROOT'].'<br>';
echo ' current-file = '.__FILE__.'<br>';
echo ' current-dir = '.dirname(__FILE__).'<br>';
echo ' http-root = '.$_SERVER['HTTP_HOST'].'<br>';
echo ' web-position = '.$_SERVER['PHP_SELF'].'<br>';
$file='c:/webroot/index.php';
echo ' file-position = '.$file.'<br>';
$fileWebAddress='http://'.str_replace($_SERVER['DOCUMENT_ROOT'],$_SERVER['HTTP_HOST'],$file);
echo ' file-web-position = '.$fileWebAddress.'<br>';
?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询