先上个效果图:
sample6_1.php 中创建form:
复制代码 代码如下:
//显示上传状态和图片
//上传文件需要定义enctype,为了显示图片将target设为uploadframe
enctype=multipart/form-data target=uploadframe>
upload a file:
//上传文件
上传图片函数 uploadimg:
复制代码 代码如下:
function uploadimg(theform){
//提交form
theform.submit();
//在showimg
中显示上传状态
setstatus (loading...,showimg);
}
//上传状态函数
function setstatus (thestatus, theobj){
obj = document.getelementbyid(theobj);
if (obj){
obj.innerhtml = + thestatus +
;
}
}
process_upload.php 提供文件上传功能:
复制代码 代码如下:
br>http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
>
上面代码最后部分的doneloading 函数就是用来显示图片及修改图片尺寸大小。其中会用到thumb.php,它会在images目录中生成出源图片的大、中、小三个尺寸,有兴趣可以研究一下。欢迎大家拍砖~
文中源码打包下载 以上就介绍了图像处理软件photoshop ajax+php边学边练 之五 图片处理,包括了图像处理软件photoshop方面的内容,希望对php教程有兴趣的朋友有所帮助。