失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > win7任务栏缩略图 图片上传制作缩略图–类似手机相册

win7任务栏缩略图 图片上传制作缩略图–类似手机相册

时间:2019-06-07 14:08:49

相关推荐

win7任务栏缩略图 图片上传制作缩略图–类似手机相册

后端开发|php教程

win7任务栏缩略图

后端开发-php教程

多级会员管理系统源码,VScode空白,ubuntu进入cmd,tomcat -user,SQlite的类型,服务器不能access数据库,js搜索匹配插件,华为开源前端框架,上海 爬虫工程师,php对齐,光钰seo,手机网站下拉列表,简单的网页播放器,ecshop 评论模板,可以读网页面数字软件下载,管理系统v1.0.0.0,马克斯各种x站h站程序模板lzw

function uploadPic(){$back_code = array();$upTypes = array(image/jpg,image/jpeg,image/png,image/gif,image/bmp,);$temp = array(1=>gif, 2=>jpeg, 3=>png);$max_file_size = 10000000; // 文件大小限制$upload_dir = "/var/www/html//Upload/WeddingSpace/"; // 上传路径$date_dir = date("Y-m-d",time()); // 按日期分目录存储$update_time = date("Y-m-d H:i:s",time()); // 按日期分目录存储$conn = connect_to_db();// 判断文件类型和文件大小if(in_array($_FILES[file][ ype], $upTypes) && $_FILES[file][size] 0){$back_code[ um] = -2;$back_code[msg] = $_FILES["file"]["error"] ;}else{// 获取手机照片的旋转角信息 1:0°,6:顺90°,8:逆90°,3:180°$exif_arr = exif_read_data($_FILES[file][ mp_name], IFD0);$Orientation = $exif_arr[Orientation];if($Orientation == 1){$degrees = 0;}else if($Orientation == 6){$degrees = 270;}else if($Orientation == 8){$degrees = 90;}else if($Orientation == 3){$degrees = 180;}$photo_postfix = explode(/, $_FILES[file][ ype])[1];$randStrArr = getUrl();$photo_name = $randStrArr[ andStr] . $randStrArr[ imeStr] . . . $photo_postfix; // 文件名$thumb_name = humb_ . $photo_name ;$photo_url = $date_dir . / . $photo_name;$thumb_url = $date_dir . / . humb_ . $photo_name ;// 判断是否存在目录并创建if(!is_dir($upload_dir . $date_dir)){mkdir($upload_dir . $date_dir);}// 制作缩略图 *****$size_wh = getimagesize($_FILES[file][ mp_name]);//{0: 1280, 1: 800, 2: 2, 3: "width="1280" height="800"", bits: 8, channels: 3, mime: "image/jpeg"}$thumb_width = 300;$thumb_height = 300;$size_width = $size_wh[0]; // 宽$size_height = $size_wh[1]; // 高$img_type = $size_wh[2]; // 文件类型 $create_name = imagecreatefrom. $temp[$img_type]; $output_name = image . $temp[$img_type]; // $cimg = imagecreatetruecolor($thumb, $thumb); $timg = imagecreatetruecolor(300,300); $source = $create_name($_FILES[file][ mp_name]); $ratio_w=1.0 * $thumb_width / $size_width; $ratio_h=1.0 * $thumb_height / $size_height; $ratio=1.0; if( ($ratio_w < 1 && $ratio_h 1 && $ratio_h > 1)){ $ratio = $ratio_w < $ratio_h ? $ratio_h : $ratio_w; $tmp_w = (int)($thumb_width / $ratio); $tmp_h = (int)($thumb_height / $ratio); $tmp_img=imagecreatetruecolor($tmp_w , $tmp_h); $src_x = (int) (($size_width-$tmp_w)/2) ; $src_y = (int) (($size_height-$tmp_h)/2) ;imagecopy($tmp_img, $source, 0,0,$src_x,$src_y,$tmp_w,$tmp_h);imagecopyresampled($timg,$tmp_img,0,0,0,0,$thumb_width,$thumb_height,$tmp_w,$tmp_h); imagedestroy($tmp_img); }else{ $ratio = $ratio_w $thumb_width){ // $new_height = 0; // $new_width = // } // imagecopyresampled($cimg, $source, 0,0, 0,0, $thumb,$thumb, $size_width,$size_height); // imagecopyresampled($timg, $cimg, 0,0, 0,0, 120,120, $thumb,$thumb); // imagecopyresampled($timg, $source, 0,0, $tw,$th, 240,240, $size_width,$size_height); $rotate = imagerotate($timg, $degrees, 0); if($output_name($rotate , $upload_dir . $date_dir . / . $thumb_name , 100)){ // 上传文件if(move_uploaded_file($_FILES[file][ mp_name], $upload_dir . $date_dir . / . $photo_name)){$insert_sql = "INSERT INTO `wedding_space_photo` (openid,wedding_ID,big_photo,small_photo,update_time) VALUES ($openid,$wedding_ID,$photo_url,$thumb_url,$update_time) ";mysql_query($insert_sql);$id = mysql_insert_id();$back_code[ um] = 0;$back_code[msg] = "上传成功";$back_code[img_id] = $id;$back_code[src] = "/Upload/WeddingSpace/".$date_dir. / .$photo_name;$back_code[ humb_src] = "/Upload/WeddingSpace/".$date_dir. / .$thumb_name;}else{$back_code[ um] = -4;$back_code[msg] = "上传失败,请重试";} }else{$back_code[ um] = -5;$back_code[msg] = "做略图制作失败,请重试";}}}else{$back_code[ um] = -3;$back_code[msg] = "上传文件非法";}return $back_code;}

九零源码交易,ubuntu下分割磁盘,买完域名tomcat配置,爱发电爬虫,php博客思路,湖南seo网络营销推广多少钱lzw

以上就介绍了win7任务栏缩略图 图片上传制作缩略图–类似手机相册,包括了win7任务栏缩略图方面的内容,希望对PHP教学有兴趣的朋友有所帮助。

广告评测网源码,vscode编码怎么样,n卡安装ubuntu,sql注入 tomcat,sqlite stu,什么是分屏网页设计,数据库主机,.net 获取服务器路径问题,ecmall插件开发,code前端框架,爆款爬虫,韩顺平php视频教程,seo专业培训班,大厂springboot文档,织梦广告标签调用,投资理财网站源码asp,易语言网页游戏优化,bootstrap门户模板下载,公司网站asp后台维护,html5页面导航左右滑动,图书管理系统网页源码,大淘客淘宝客程序lzw

如果觉得《win7任务栏缩略图 图片上传制作缩略图–类似手机相册》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。