PHP上传类 图片上传 upload class实现image crop resize 缩略图
2024-08-25 19:39:33
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;
}
参考:
最新文章
- win7,M​i​n​d​m​a​n​a​g​e​r​2​0​1​2使用模板时弹出Runtime error R6025解决方法
- What technical details should a programmer of a web application consider before making the site public?
- LOOPS(HDU 3853)
- ORM和Hibernate的配置方式
- 转载—— android 瀑布流的实现详解,附源码
- Jetson TK1 Restore 步骤
- 2013 Multi-University Training Contest 1 Partition
- js页面刷新的几种方法
- Winform- IrisSkin.dll轻松实现窗体换肤功能
- NOIP2001 一元三次方程求解
- 用bootstrap结合php搭建MIS系统框架【转载】
- 网易云课堂_程序设计入门-C语言_第六章:数组_1多项式加法
- Python主要模块和常用方法简览
- HUST 1583 长度单位
- C语言——第七周作业
- flask 定义数据关系(多对一)
- Activiti For Eclipse(Mars)插件配置
- msys2 设置home路径为windows用户路径
- 近期js
- SQL 从查询结果里查询