zoukankan      html  css  js  c++  java
  • PHP上传类 图片上传 upload class实现image crop resize 缩略图

    manage uploaded files, and manipulate images in many ways
    through an HTML form, a Flash uploader, XMLHttpRequest or on local files. 
    Supported formats are PNG, JPG, GIF and BMP.
    可以加边框,
    示例:
    一,操作本地文件
    if(file_exists($localfile)){//本地文件
            $handle = new upload($localfile);//操作本地文件
            if ($handle->uploaded) {            
                  $handle->file_name_body_pre   = 'thumb_';  //目标文件在原文件基础上加的前缀
                  $handle->image_resize         = true;
                  $handle->image_x              = 100;
                  $handle->image_ratio_y        = true;
                  $handle->process($localpath);     //目的文件保存路径         
                  if($handle->processed) {                 
                     //$handle->clean();//delete the original uploaded file
                    echo_1('ok');return;          
                  }else{
                      echo_0($handle->error);return;                
                  }
            }else{
                echo_0($handle->error);return;        
            }        
        }else{        
            echo_0('upload failed');return;    
        }
    参考:
  • 相关阅读:
    Javascript事件模型
    关于node.js(一)
    JavaScript表单编程总结
    使用Dom操纵样式表
    文档对象模型Dom
    浏览器对象模型BOM总结
    在javascript中正则表达式的概念与应用
    CSS块级元素、内联元素概念
    HTTP协议
    [学习记录]BFS思路详解
  • 原文地址:https://www.cnblogs.com/elesos/p/5924452.html
Copyright © 2011-2022 走看看