Home > php教程 > php手册 > body text

仿新浪微博头像上传(适用于TP3.1.X及以上)

WBOY
Release: 2016-06-07 11:42:12
Original
1729 people have browsed it

仿新浪微博上传头像组件,用ajax效果更好
仿新浪微博头像上传(适用于TP3.1.X及以上)
仿新浪微博头像上传,支持本地图片拖动裁剪并时时预览,调用本地摄像头拍照并支持拖动裁剪,支持自定义亮度,对比度,饱和度,支持头像放大缩小,左右旋转。可以自定义上传目录以及图片后缀。采用ajax返回头像上传途径已经上传状态。完美兼容火狐,IE浏览器。组件下载地址http://www.gouguoyin.cn/php/29.htm,使用过程中有任何疑问请咨询QQ:245629560。

模板页代码nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br> <br> <br>   <script><br /> function uploadevent(status,picUrl,callbackdata){<br /> var time = new Date().getTime();<br /> var filename162 = picUrl+&#039;_162.jpg&#039;;<br /> var filename48 = picUrl+&#039;_48.jpg&#039;;<br /> var filename20 = picUrl+"_20.jpg";<br /> window.location.href="__APP__/member/do_avatar_edit?url="+filename162;<br /> <br /> }<br /> </script><br> <br> <br> <br> <br> <div> <br> <br> <br> <!--一定要注意PARAM里面的路径--><br> <object></object> codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"<br> WIDTH="650" HEIGHT="450" id="myMovieName"><br> <param> <br> <param> <br> <param> <br> <param> <br> <embed></embed> NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" allowScriptAccess="always"<br> PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"><br> <br> <br> <br> </div> <br> <br> 控制器代码<?php <br /> // 会员模块<br> class MemberAction extends Action {<br>     //头像修改页面<br>     public function avatar_edit(){<br>         //验证是否登录<br>         $this->islogin();<br>         //显示模板<br>         $this->display();<br>     }<br>     //处理头像修改方法<br>     public function do_avatar_edit(){<br>         $avatar=ltrim($_GET['url'],'../../');<br>         $user_id=session('user_id');<br>         <br>         $user_info=M('User_info');<br>         $data['user_avatar']=$avatar;<br>         <br>         $result=$user_info->where("user_id=$user_id")->save($data);<br>         if($result === FALSE){<br>             $this->error('头像修改失败!');<br>         }elseif($result === 0){<br>             $this->error('头像未做修改!');<br>         }else{<br>             $this->success('头像修改成功!');<br>         }<br>     }<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template