书上的一段原码,看看吧
<?php $image = $_REQUEST['image'];
$max_width = $_REQUEST['max_width'];
$max_height = $_REQUEST['max_height']; if (!$max_width)
$max_width = 80;
if (!$max_height)
$max_height = 60; $size = GetImageSize($image);
$width = $size[0];
$height = $size[1]; $x_ratio = $max_width / $width;
$y_ratio = $max_height / $height; if ( ($width <= $max_width) && ($height <= $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
} $src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);?>
解决方案 »
- 郁闷,求解!我的wampserver安装完成后为什么打开localhost后回事360无法显示页面!
- 【100分】简单网站搭建
- 提交不到MY SQL ?????
- php和excelparser的问题
- 求php入门的学习资料(高分相送)
- 手工刷新conn.php有可能用光服务器资源吗??
- 新手动工!
- 在我提交网页时出现了405 The requested method POST is not allowed for the URL /index2.php 的错误 ,急啊。各位大哥
- 免费150M空间申请,支持ftp访问.申请成功马上开通
- 问两个小问题
- mysql_num_rows():supplied argument is not a valid MYsql
- php简单问题
代码如下:
<html>
<body>
<?
var x="http://123.html";
?>
<input name="simg" type="text" size="37" value="<?echo x; ?>" disabled>
</body>
</html>
<body>
<?
$x="http://123.html"; //这是你要抓到的路径
?>
<input name="simg" type="text" size="37" value=" <?echo $x; ?>" disabled> //把那个变数$x放这里!
</body>
</html>
对不起,我把代码写错了!
如我要做一个产品系统
代码如下
商品名称:<input type="text" name="user" size="10" maxlength="10">
商品图片:<input name="simg" type="text" size="37"><br>
<iframe style="top:2px" ID="UpFile" src="../inc/Upload.php" frameborder=0 scrolling=no width="100%" height="27"> </iframe>
点上传后图片路径在:<input name="simg" type="text" size="37">中显示出来
然后
../inc/Upload.php 从这个页面的提交到的php页面里输出js来设置
如upload.php 提交到upfile.php,则可以在upfile.php中输出如下的jsupfile.php<?php
$FilePath="";//保存文件路径的代码
//保存文件的代码并且设置$FilePath变量//保存成功后输出jsecho "<script>parent.document.getElementById('simg').value='{$FilePath}';</script>";
die();
?>