del
							parent
							
								
									46834735cc
								
							
						
					
					
						commit
						14465b18b2
					
				|  | @ -1,22 +0,0 @@ | |||
| { | ||||
|     // 使用 IntelliSense 了解相关属性。  | ||||
|     // 悬停以查看现有属性的描述。 | ||||
|     // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 | ||||
|     "version": "0.2.0", | ||||
|     "configurations": [ | ||||
|         { | ||||
|             "name": "Listen for XDebug", | ||||
|             "type": "php", | ||||
|             "request": "launch", | ||||
|             "port": 9999 | ||||
|         }, | ||||
|         { | ||||
|             "name": "Launch currently open script", | ||||
|             "type": "php", | ||||
|             "request": "launch", | ||||
|             "program": "${file}", | ||||
|             "cwd": "${fileDirname}", | ||||
|             "port": 9999 | ||||
|         } | ||||
|     ] | ||||
| } | ||||
|  | @ -0,0 +1,165 @@ | |||
|   GNU LESSER GENERAL PUBLIC LICENSE | ||||
|                        Version 3, 29 June 2007 | ||||
| 
 | ||||
|  Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | ||||
|  Everyone is permitted to copy and distribute verbatim copies | ||||
|  of this license document, but changing it is not allowed. | ||||
| 
 | ||||
| 
 | ||||
|   This version of the GNU Lesser General Public License incorporates | ||||
| the terms and conditions of version 3 of the GNU General Public | ||||
| License, supplemented by the additional permissions listed below. | ||||
| 
 | ||||
|   0. Additional Definitions. | ||||
| 
 | ||||
|   As used herein, "this License" refers to version 3 of the GNU Lesser | ||||
| General Public License, and the "GNU GPL" refers to version 3 of the GNU | ||||
| General Public License. | ||||
| 
 | ||||
|   "The Library" refers to a covered work governed by this License, | ||||
| other than an Application or a Combined Work as defined below. | ||||
| 
 | ||||
|   An "Application" is any work that makes use of an interface provided | ||||
| by the Library, but which is not otherwise based on the Library. | ||||
| Defining a subclass of a class defined by the Library is deemed a mode | ||||
| of using an interface provided by the Library. | ||||
| 
 | ||||
|   A "Combined Work" is a work produced by combining or linking an | ||||
| Application with the Library.  The particular version of the Library | ||||
| with which the Combined Work was made is also called the "Linked | ||||
| Version". | ||||
| 
 | ||||
|   The "Minimal Corresponding Source" for a Combined Work means the | ||||
| Corresponding Source for the Combined Work, excluding any source code | ||||
| for portions of the Combined Work that, considered in isolation, are | ||||
| based on the Application, and not on the Linked Version. | ||||
| 
 | ||||
|   The "Corresponding Application Code" for a Combined Work means the | ||||
| object code and/or source code for the Application, including any data | ||||
| and utility programs needed for reproducing the Combined Work from the | ||||
| Application, but excluding the System Libraries of the Combined Work. | ||||
| 
 | ||||
|   1. Exception to Section 3 of the GNU GPL. | ||||
| 
 | ||||
|   You may convey a covered work under sections 3 and 4 of this License | ||||
| without being bound by section 3 of the GNU GPL. | ||||
| 
 | ||||
|   2. Conveying Modified Versions. | ||||
| 
 | ||||
|   If you modify a copy of the Library, and, in your modifications, a | ||||
| facility refers to a function or data to be supplied by an Application | ||||
| that uses the facility (other than as an argument passed when the | ||||
| facility is invoked), then you may convey a copy of the modified | ||||
| version: | ||||
| 
 | ||||
|    a) under this License, provided that you make a good faith effort to | ||||
|    ensure that, in the event an Application does not supply the | ||||
|    function or data, the facility still operates, and performs | ||||
|    whatever part of its purpose remains meaningful, or | ||||
| 
 | ||||
|    b) under the GNU GPL, with none of the additional permissions of | ||||
|    this License applicable to that copy. | ||||
| 
 | ||||
|   3. Object Code Incorporating Material from Library Header Files. | ||||
| 
 | ||||
|   The object code form of an Application may incorporate material from | ||||
| a header file that is part of the Library.  You may convey such object | ||||
| code under terms of your choice, provided that, if the incorporated | ||||
| material is not limited to numerical parameters, data structure | ||||
| layouts and accessors, or small macros, inline functions and templates | ||||
| (ten or fewer lines in length), you do both of the following: | ||||
| 
 | ||||
|    a) Give prominent notice with each copy of the object code that the | ||||
|    Library is used in it and that the Library and its use are | ||||
|    covered by this License. | ||||
| 
 | ||||
|    b) Accompany the object code with a copy of the GNU GPL and this license | ||||
|    document. | ||||
| 
 | ||||
|   4. Combined Works. | ||||
| 
 | ||||
|   You may convey a Combined Work under terms of your choice that, | ||||
| taken together, effectively do not restrict modification of the | ||||
| portions of the Library contained in the Combined Work and reverse | ||||
| engineering for debugging such modifications, if you also do each of | ||||
| the following: | ||||
| 
 | ||||
|    a) Give prominent notice with each copy of the Combined Work that | ||||
|    the Library is used in it and that the Library and its use are | ||||
|    covered by this License. | ||||
| 
 | ||||
|    b) Accompany the Combined Work with a copy of the GNU GPL and this license | ||||
|    document. | ||||
| 
 | ||||
|    c) For a Combined Work that displays copyright notices during | ||||
|    execution, include the copyright notice for the Library among | ||||
|    these notices, as well as a reference directing the user to the | ||||
|    copies of the GNU GPL and this license document. | ||||
| 
 | ||||
|    d) Do one of the following: | ||||
| 
 | ||||
|        0) Convey the Minimal Corresponding Source under the terms of this | ||||
|        License, and the Corresponding Application Code in a form | ||||
|        suitable for, and under terms that permit, the user to | ||||
|        recombine or relink the Application with a modified version of | ||||
|        the Linked Version to produce a modified Combined Work, in the | ||||
|        manner specified by section 6 of the GNU GPL for conveying | ||||
|        Corresponding Source. | ||||
| 
 | ||||
|        1) Use a suitable shared library mechanism for linking with the | ||||
|        Library.  A suitable mechanism is one that (a) uses at run time | ||||
|        a copy of the Library already present on the user's computer | ||||
|        system, and (b) will operate properly with a modified version | ||||
|        of the Library that is interface-compatible with the Linked | ||||
|        Version. | ||||
| 
 | ||||
|    e) Provide Installation Information, but only if you would otherwise | ||||
|    be required to provide such information under section 6 of the | ||||
|    GNU GPL, and only to the extent that such information is | ||||
|    necessary to install and execute a modified version of the | ||||
|    Combined Work produced by recombining or relinking the | ||||
|    Application with a modified version of the Linked Version. (If | ||||
|    you use option 4d0, the Installation Information must accompany | ||||
|    the Minimal Corresponding Source and Corresponding Application | ||||
|    Code. If you use option 4d1, you must provide the Installation | ||||
|    Information in the manner specified by section 6 of the GNU GPL | ||||
|    for conveying Corresponding Source.) | ||||
| 
 | ||||
|   5. Combined Libraries. | ||||
| 
 | ||||
|   You may place library facilities that are a work based on the | ||||
| Library side by side in a single library together with other library | ||||
| facilities that are not Applications and are not covered by this | ||||
| License, and convey such a combined library under terms of your | ||||
| choice, if you do both of the following: | ||||
| 
 | ||||
|    a) Accompany the combined library with a copy of the same work based | ||||
|    on the Library, uncombined with any other library facilities, | ||||
|    conveyed under the terms of this License. | ||||
| 
 | ||||
|    b) Give prominent notice with the combined library that part of it | ||||
|    is a work based on the Library, and explaining where to find the | ||||
|    accompanying uncombined form of the same work. | ||||
| 
 | ||||
|   6. Revised Versions of the GNU Lesser General Public License. | ||||
| 
 | ||||
|   The Free Software Foundation may publish revised and/or new versions | ||||
| of the GNU Lesser General Public License from time to time. Such new | ||||
| versions will be similar in spirit to the present version, but may | ||||
| differ in detail to address new problems or concerns. | ||||
| 
 | ||||
|   Each version is given a distinguishing version number. If the | ||||
| Library as you received it specifies that a certain numbered version | ||||
| of the GNU Lesser General Public License "or any later version" | ||||
| applies to it, you have the option of following the terms and | ||||
| conditions either of that published version or of any later version | ||||
| published by the Free Software Foundation. If the Library as you | ||||
| received it does not specify a version number of the GNU Lesser | ||||
| General Public License, you may choose any version of the GNU Lesser | ||||
| General Public License ever published by the Free Software Foundation. | ||||
| 
 | ||||
|   If the Library as you received it specifies that a proxy can decide | ||||
| whether future versions of the GNU Lesser General Public License shall | ||||
| apply, that proxy's public statement of acceptance of any version is | ||||
| permanent authorization for you to choose that version for the | ||||
| Library. | ||||
							
								
								
									
										108
									
								
								README.md
								
								
								
								
							
							
						
						
									
										108
									
								
								README.md
								
								
								
								
							|  | @ -1,48 +1,39 @@ | |||
| #### 首页演示: | ||||
|  | ||||
|  | ||||
| #### 管理界面演示: | ||||
|  | ||||
| 
 | ||||
| ## EasyImage 简单图床 | ||||
| > 支持多文件上传,异地上传,api上传,简单无数据库,返回图片url,markdown,bbscode,html的一款图床程序 | ||||
| 演示地址: [https://img.545141.com](https://img.545141.com"https://img.545141.com") | ||||
| 之前一直用的图床程序是:[PHP多图长传程序2.4.3](http://www.mycodes.net/48/4925.htm "PHP多图长传程序2.4.3") | ||||
| > 支持多文件上传,异地上传,api上传,简单无数据库,返回图片url,markdown,bbscode,html的一款自适应图床程序 | ||||
| 演示地址:[https://img.545141.com](https://img.545141.com "PHP多图片上传程序 2.4.3") | ||||
| 之前一直用的图床程序是:[PHP多图片上传程序 2.4.3](http://www.mycodes.net/48/4925.htm "PHP多图片上传程序 2.4.3") | ||||
| 由于版本过老并且使用falsh上传,在当前html5流行大势所趋下,遂利用基础知识新写了一个以html5为默认上传并且支持flash,向下兼容至IE9。 | ||||
| 
 | ||||
| #### 功能支持: | ||||
| - [x] 支持仅登录后上传 | ||||
| - [x] 支持设置图片质量 | ||||
| - [x] 支持QQ截图,剪切板上传 | ||||
| - [x] 支持在线管理(增删改查) | ||||
| - [x] 支持上传图片转换为指定格式 | ||||
| - [x] 支持文字/图片水印 文字/图片水印透明度 | ||||
| - [x] 支持压缩图片并自定义图片质量,相比之前提高5倍以上 | ||||
| - [x] 支持设置上传页面广告 | ||||
| - [x] 支持设置图片指定宽/高 | ||||
| - [x] 支持最低上传宽度/高度 | ||||
| - [x] 支持开启/关闭api上传(默认关闭) | ||||
| - [x] 支持上传图片至远程服务器(异域存储,默认关闭) | ||||
| - [x] 支持网站统计 请将统计代码放入:public/static/hm.js | ||||
| 
 | ||||
| <b>注意:</b> | ||||
| 
 | ||||
| 1. 装之前先使用服务器打开check.php检查扩展是否都安装! | ||||
| 2. js不要设置分片上传大小,此会导致部分图片上传失败。 | ||||
| 3. 使用前请注意先修改config.php中的domain域名。 | ||||
| 4. 安装正常后请修改登录上传密码和管理密码!具体如何修改可以打开config.php里边有注释。 | ||||
| 5. 如果无法登陆管理界面或上传图片,请先打开check.php检查扩展。 | ||||
| 6. 默认我会给你设置成最优方案,如果需要其他的功能,比如异地存储和api上传,请仔细查看config.php文件 | ||||
| 
 | ||||
| 
 | ||||
| ##### 一年未更新了,这次带来了全新版本2.0! | ||||
| - 在继承上个版本(1.6.4)的基础上进行了全新优化 | ||||
| - 修复上传经常失败的问题 | ||||
| - 删除一些不常用但会增加功耗的过程 (删除的在下边会有标记) | ||||
| - 全新的压缩 将文件继续缩小 | ||||
| - 全新的目录系统,精简代码 | ||||
| - 设置仅允许在config.php修改,注释更加明了,即使没有代码基础也可以操作 | ||||
| - 增加新的文件管理系统 | ||||
| 2. 使用前请注意先修改config.php中的domain域名。 | ||||
| 3. 安装正常后请修改登录上传密码和管理密码!具体如何修改可以打开config.php里边有注释。 | ||||
| 4. 如果无法登陆管理界面或上传图片,请先打开check.php检查扩展或者使用phpinfo检查。 | ||||
| 5. 默认我会给你设置成最优方案,api与异域上传默认关闭,如需要异地存储和api上传,请仔细查看教程。 | ||||
| 6. 下载源码后可以精简一些文件:README.md,check.php,LICENSE如不需要异域存储,可以删除crossdomain文件夹。 | ||||
| 
 | ||||
| <hr /> | ||||
| 
 | ||||
| #### 功能支持: | ||||
| 
 | ||||
| - 支持设置图片质量 | ||||
| - 支持上传图片转换为指定格式 | ||||
| - 支持设置图片指定宽/高 | ||||
| - 支持限制最低宽度/高度上传 | ||||
| - 支持静态文件CDN/本地切换 | ||||
| - ~~支持开启/关闭浏览最近上传图片~~ -> 使用最新的管理系统 | ||||
| - 支持仅登录后上传 | ||||
| - 支持设置广告 | ||||
| - 支持网站统计 请将统计代码放入:public/static/hm.js | ||||
| - 图片管理(删除,查看) | ||||
| - 支持上传图片至远程服务器(异域存储) | ||||
| - 支持开启/关闭api上传 | ||||
| 
 | ||||
| #### api上传示例: | ||||
| 参数: | ||||
| 
 | ||||
|  | @ -84,65 +75,82 @@ header('Access-Control-Allow-Origin:https://A.com/') | |||
| 指定域名可以限制别人上传图片!(并不能保证完全能防止,毕竟可以伪造) | ||||
| 
 | ||||
| --- | ||||
| * 2019-5-23 v2.0 | ||||
|  2019-5-31 v2.0.1.9 | ||||
| - 增加复制链接按钮 | ||||
| - 恢复开启/关闭api上传 | ||||
| - 恢复支持水印文字颜色 | ||||
| - 恢复支持远程上传图片 | ||||
| - 增加QQ截图,剪切板上传 | ||||
| - 增加文字/图片水印透明度 | ||||
| - 纪念一下2019年,将版本号改为2.0.1.9 | ||||
| - 修改图片压缩方式,速度更快,相比之前提高5倍以上 | ||||
| - 修复在centos64 lnmp1.6 php7.1环境下的图片信息读取问题 | ||||
| - 修复安装时候的权限 | ||||
| - 更改管理路径 | ||||
| - 更改上传路径,文件名更短 | ||||
| - 添加暂停按钮 | ||||
| 
 | ||||
| 
 | ||||
|  2019-5-23 v2.0 | ||||
| - 在继承上个版本(1.6.4)的基础上进行了全新优化 | ||||
| - 修复上传经常失败的问题 | ||||
| - 删除一些不常用但会增加功耗的过程 | ||||
| - 全新的压缩 将文件继续缩小 | ||||
| - 全新的目录系统,精简代码 | ||||
| - 设置仅允许在config.php修改,注释更加明了,即使没有代码基础也可以操作 | ||||
| - 增加新的文件管理系统,感谢 tinyfilemanager | ||||
| - ~~支持文字/图片水印 可自定义文字颜色~~ | ||||
| - 增加新的文件管理系统,支持增删改查 | ||||
| - ~~支持删除远程上传文件~~ | ||||
| - 支持文字/图片水印 可自定义文字颜色~~ | ||||
| - ~~支持文字水印背景颜色~~ | ||||
| - ~~支持文字水印透明度~~ | ||||
| - ~~支持删除远程上传文件~~ -> 不再支持删除远程文件 | ||||
| - ~~(支持开启/关闭api自定义文字水印)~~ | ||||
| - ~~支持删除自定义删除图片(仅管理员)~~ | ||||
| 
 | ||||
| * 2018-8-17 v1.6.4 | ||||
|  2018-8-17 v1.6.4 | ||||
| - 支持删除远程上传文件 | ||||
| - 更改字体 | ||||
| - 添加api/远程上传 标识 | ||||
| * 2018-8-16 v1.6.3 | ||||
| 
 | ||||
|  2018-8-16 v1.6.3 | ||||
| - 支持开启/关闭api上传(支持开启/关闭api自定义文字水印) | ||||
| - 修复权限错误 | ||||
| - 修复二级目录引入错误 | ||||
| 
 | ||||
| * 2018-8-8 v1.5.3 | ||||
|  2018-8-8 v1.5.3 | ||||
| - 添加上传图片至远程主机 | ||||
| - 修复逻辑 | ||||
| 
 | ||||
| * 2018-8-6 v1.4.3 | ||||
|  2018-8-6 v1.4.3 | ||||
| - 添加网站统计 | ||||
| - 添加删除上传文件 | ||||
| - 调整config.php | ||||
| 
 | ||||
| * 2018-8-5 v1.4.2 | ||||
|  2018-8-5 v1.4.2 | ||||
| - 添加仅登录后上传 | ||||
| - 修复一处逻辑错误 | ||||
| - 修复一个漏洞 | ||||
| 
 | ||||
| * 2018-8-4 v1.3.2 | ||||
|  2018-8-4 v1.3.2 | ||||
| - 添加广告设置 | ||||
| - 完善引入机制 | ||||
| 
 | ||||
| * 2018-8-3 v1.2.2 | ||||
|  2018-8-3 v1.2.2 | ||||
| - [重要]修复水印图片不能添加 | ||||
| - 添加随机浏览上传图片 可以设定浏览数量和关闭浏览 | ||||
| - 优化代码,删除无用文件 | ||||
| - 完善一键CDN静态文件 | ||||
| 
 | ||||
| * 2018-08-02 v1.1.2 | ||||
|  2018-08-02 v1.1.2 | ||||
| - [重要] 修复gif上传添加水印成静态的问题 | ||||
| - 修复文字水印背景色不显示问题 | ||||
| - 修复在linux下的权限错误 | ||||
| - 一些优化更改 | ||||
| 
 | ||||
| * 2018-08-01 v1.0.1 | ||||
|  2018-08-01 v1.0.1 | ||||
| - 更改相关文件目录 | ||||
| - 优化代码 | ||||
| 
 | ||||
| * 2018-07-30 v1.0.0 | ||||
|  2018-07-30 v1.0.0 | ||||
| - 最初模型 | ||||
| 
 | ||||
| #### 兼容性 | ||||
|  | @ -154,4 +162,4 @@ header('Access-Control-Allow-Origin:https://A.com/') | |||
|  - 感谢: [verot](https://www.verot.net "verot" )提供非常好用的class.upload.php上传类 | ||||
|  - 感谢: [ZUI](http://zui.sexy/ "ZUI" ) 提供css框架 | ||||
|  - 感谢:[tinyfilemanager](https://github.com/prasathmani/tinyfilemanager "tinyfilemanager" ) 提供的文件管理 | ||||
|  - 本源码遵循 GNU Public License | ||||
|  - 本源码遵循 GNU Public License | ||||
|  |  | |||
							
								
								
									
										12
									
								
								check.php
								
								
								
								
							
							
						
						
									
										12
									
								
								check.php
								
								
								
								
							|  | @ -36,6 +36,12 @@ | |||
| 
 | ||||
| </html> | ||||
| <?php | ||||
| if(@isset($_POST['psw'])){ | ||||
|   echo '<hr/><br />新加密密码:<code>'.password_hash($_POST['psw'],PASSWORD_DEFAULT).'</code>'; | ||||
|   echo '<br />请将新密码全部复制并覆盖<code>/public/data/tinyfilemanager.php</code>第28行中替换相应的字符'; | ||||
|   echo '<br/>登录密码为:<code>'.$_POST['psw'].'</code>'; | ||||
| } | ||||
| 
 | ||||
| echo '<hr/>当前PHP版本:'.phpversion(); | ||||
| if(extension_loaded('gd')){ | ||||
|   echo '<br />GD已安装:'.gd_info()['GD Version']; | ||||
|  | @ -73,12 +79,6 @@ if(!extension_loaded('mbstring')){ | |||
|   echo '<br/>mbstring已安装'; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| if(@isset($_POST['psw'])){ | ||||
|   echo '<hr/><br />新加密密码:<code>'.password_hash($_POST['psw'],PASSWORD_DEFAULT).'</code>'; | ||||
|   echo '<br />请将新密码全部复制并覆盖<code>/public/data/tinyfilemanager.php</code>第28行中替换相应的字符'; | ||||
|   echo '<br/>登录密码为:<code>'.$_POST['psw'].'</code>'; | ||||
| } | ||||
| echo '<br/><br/>以下是php所有拓展和版本信息,请使用ctrl+f快速搜索查找问题:<br/>'; | ||||
| phpinfo(); | ||||
| exit; | ||||
							
								
								
									
										66
									
								
								config.php
								
								
								
								
							
							
						
						
									
										66
									
								
								config.php
								
								
								
								
							|  | @ -1,6 +1,6 @@ | |||
| <?php | ||||
| /** | ||||
|  * EasyImage - 简单图床 | ||||
|  * EasyImage - 简单图床配置 | ||||
|  * | ||||
|  * @author icret | ||||
|  * @email  lemonim@qq.com | ||||
|  | @ -14,7 +14,7 @@ header('Content-Type:text/html;charset=utf-8'); | |||
| //将时区设置为上海时区
 | ||||
| ini_set('date.timezone', 'Asia/Shanghai'); | ||||
| // 修改内存限制 根据服务器配置选择,低于128M容易出现上传失败,你懂得图片挺占用内存的
 | ||||
| ini_set('memory_limit','512M'); | ||||
| ini_set('memory_limit', '512M'); | ||||
| // 定义当前目录
 | ||||
| define('APP_ROOT', __DIR__); | ||||
| 
 | ||||
|  | @ -22,64 +22,60 @@ $config = array( | |||
|     // 网站标题
 | ||||
|      'title' => '简单图床 - EasyImage', | ||||
|     // 网站关键字
 | ||||
|      'keywords' => '简单图床,easyimage,无数据库图床', | ||||
|      'keywords' => '简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制', | ||||
|     // 网站描述
 | ||||
|      'description' => '支持多文件上传,远程上传,api上传,简单无数据库,直接返回图片url,markdown,bbscode的一款html5图床程序 。', | ||||
|      'description' => '简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序,最新html5自适应页面兼容手机电脑,上传后返回图片直链,markdown图片,论坛贴图bbscode链接,简单方便支持一键复制,支持多域名,api上传。', | ||||
|     // 网站公告
 | ||||
|      'tips' => ' 单个文件限制5M,每次最多上传30张图片。', | ||||
|      'tips' => ' 单个文件限制5M,每次最多上传30张图片,本网站仅做演示用,不对图片负任何责任。', | ||||
|     // 当前域名,末尾不加"/" 如果是异域上传请修改为当前异域域名
 | ||||
|      'domain' => 'https://img.545141.com', | ||||
|     // 存储路径 末尾需要加"/"
 | ||||
|      'path' => '/public/data/', | ||||
|     // 存储路径 前后要加"/" 如更改此目录,需要修改tinyfilemanager.php中的$directories_users路径
 | ||||
|      'path' => '/i/', | ||||
|     // 最大上传限制 默认为5m 请使用工具转换mb http://www.bejson.com/convert/filesize/
 | ||||
|      'maxSize' => 5242880, | ||||
|     // 是否开启登录上传 开启:true 关闭false
 | ||||
|      'mustLogin' => false, | ||||
|      // 登录密码 此密码非管理密码
 | ||||
|      'password'=>'7070', | ||||
|     // 登录密码 此密码非管理密码
 | ||||
|      'password' => '7080', | ||||
|     // 开启管理 开启后务必修改密码 修改方式请见read.php
 | ||||
|      'tinyfilemanager' => true, | ||||
|     // 是否开启API上传
 | ||||
|      'apiStatus' => false, | ||||
|     // 是否开启异域上传 开启true 关闭 false
 | ||||
|     'crossdomain'=>false, | ||||
|      // 异域上传域名 末尾需要加'/'
 | ||||
|      'CDomains'=>'https://img.545141.com/crossdomain/', | ||||
|      'crossdomain' => false, | ||||
|     // 异域上传域名 末尾需要加'/'
 | ||||
|      'CDomains' => 'https://img.545141.com/crossdomain/', | ||||
|     // 是否开启水印:0关闭,1文字水印,2图片水印 动态gif不能添加水印
 | ||||
|      'watermark' => 1, | ||||
|     // 水印文字内容
 | ||||
|      'waterText' => 'img.545141.com', | ||||
|     // 水印位置 T=top,B =bottom,L=left,R=right 'TBLR'中的一个或两个的组合
 | ||||
|      'waterPosition' => 'TB', | ||||
|     // 水印文字方向 h水平 v垂直
 | ||||
|      'textDirection' => 'h', | ||||
|     // 水印文字颜色
 | ||||
|      'textColor' => '#DC143C', | ||||
|      'waterText' => '简单图床 img.545141.com', | ||||
|     /** | ||||
|      * 水印位置 | ||||
|      * 0:随机位置,在1~8之间随机选取一个位置 | ||||
|      * 1:顶部居左 2:顶部居中 3:顶部居右 4:左边居中 | ||||
|      * 5:图片中心 6:右边居中  7:底部居左 8:底部居中 9:底部居右 | ||||
|      */ | ||||
|     'waterPosition' => 8, | ||||
|     // 水印文字颜色 rgba 末尾为透明度0-127 0为不透明
 | ||||
|      'textColor' => '47,79,79,0', | ||||
|     // 水印文字大小
 | ||||
|      'textSize' => 16, | ||||
|     // 字体大小或字体的相对路径
 | ||||
|      'textFont' => APP_ROOT.'/public/static/imitationSong.ttf', | ||||
|     // 水印边距 px
 | ||||
|      'textPadding' => 10, | ||||
|     // 水印透明度
 | ||||
|      'textOpacity' => 100, | ||||
|     // 字体路径 如果想改变字体,请选择支持中文的 gb2312
 | ||||
|      'textFont' => APP_ROOT . '/public/static/hkxzy.ttf', | ||||
|     // 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha
 | ||||
|      'waterImg' => 'public/static/watermark.png', | ||||
|     // 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
 | ||||
|      'imgConvert' => '', | ||||
|     // 设置PNG图像的压缩级别,介于1(快速但大文件)和9(慢速但较小的文件)之间 默认值:null
 | ||||
|      'zipPNG' => null, | ||||
|     // 设置JPEG图像的压缩质量(默认值:85)
 | ||||
|      'zipJPEG' => 85, | ||||
|     // 使用imagejpeg压缩 0为关闭输入值0-1,值越大质量越高
 | ||||
|     'jpg_zip_php'=>0.8, | ||||
|     // 是否通过缩放来压缩,如果要保持源图比例,把参数$percent保持为1,范围 0.1-1
 | ||||
|      // 即使原比例压缩,也可大幅度缩小。如果缩小比例,则体积会更小。
 | ||||
|      'imgcompress_percent' => 0.95, | ||||
|     //最大宽度
 | ||||
|      'maxWidth' => 10240, | ||||
|     // 最大高度
 | ||||
|      'maxHeight' => 10240, | ||||
|     // 最小宽度
 | ||||
|     // 允许上传的最小宽度
 | ||||
|      'minWidth' => 5, | ||||
|     // 最小高度
 | ||||
|     // 允许上传的最小高度
 | ||||
|      'minHeight' => 5, | ||||
|     // 等比例缩小图片 宽度和高度请设置 image_x image_y 开启true,关闭false 关闭下mage_x和image_y设置不生效
 | ||||
|      'imgRatio' => false, | ||||
|  | @ -93,5 +89,5 @@ $config = array( | |||
|      'ad_top' => false, | ||||
|     //  开启底部广告 如果想添加或修改广告请到 public/static/ad_bot.html
 | ||||
|      'ad_bot' => false, | ||||
|      'Version' => '2.0.0.9' | ||||
| ); | ||||
|     'Version' => '2.0.1.9', | ||||
| ); | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| <?php | ||||
| /** | ||||
|  * EasyImage - 简单图床 | ||||
|  * EasyImage - 简单图床异域存储配置 | ||||
|  * | ||||
|  * @author icret | ||||
|  * @email  lemonim@qq.com | ||||
|  | @ -54,11 +54,11 @@ $config = array( | |||
|     // 水印文字方向 h水平 v垂直
 | ||||
|      'textDirection' => 'h', | ||||
|     // 水印文字颜色
 | ||||
|      'textColor' => '#DC143C', | ||||
|      'textColor' => '#778899', | ||||
|     // 水印文字大小
 | ||||
|      'textSize' => 16, | ||||
|     // 字体大小或字体的相对路径
 | ||||
|      'textFont' => APP_ROOT.'/public/static/imitationSong.ttf', | ||||
|     // 字体路径 如果想改变字体,请选择支持中文的 gb2312
 | ||||
|      'textFont' => APP_ROOT.'/public/static/hkxzy.ttf', | ||||
|     // 水印边距 px
 | ||||
|      'textPadding' => 10, | ||||
|     // 水印透明度
 | ||||
|  | @ -67,12 +67,9 @@ $config = array( | |||
|      'waterImg' => 'public/static/watermark.png', | ||||
|     // 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
 | ||||
|      'imgConvert' => '', | ||||
|     // 设置PNG图像的压缩级别,介于1(快速但大文件)和9(慢速但较小的文件)之间 默认值:null
 | ||||
|      'zipPNG' => null, | ||||
|     // 设置JPEG图像的压缩质量(默认值:85)
 | ||||
|      'zipJPEG' => 85, | ||||
|     // 使用imagejpeg压缩 0为关闭输入值0-1,值越大质量越高
 | ||||
|     'jpg_zip_php'=>0.8, | ||||
|      // 是否通过缩放来压缩,如果要保持源图比例,把参数$percent保持为1,范围 0.1-1
 | ||||
|     // 即使原比例压缩,也可大幅度缩小。如果缩小比例,则体积会更小。
 | ||||
|     'imgcompress_percent' => 0.9, | ||||
|     //最大宽度
 | ||||
|      'maxWidth' => 10240, | ||||
|     // 最大高度
 | ||||
|  |  | |||
|  | @ -24,10 +24,6 @@ if($handle->uploaded){ | |||
|     $handle->image_min_height = $config['minHeight'];     | ||||
|     // 转换图片为指定格式
 | ||||
|     $handle->image_convert = $config['imgConvert']; | ||||
|     //PNG图片压缩
 | ||||
|     $handle->png_compression = $config['zipPNG']; | ||||
|     //JPEG图片压缩
 | ||||
|     $handle->jpeg_quality = $config['zipJPEG']; | ||||
|      | ||||
|     //等比例缩减图片
 | ||||
|     if($config['imgRatio']){ | ||||
|  | @ -86,19 +82,13 @@ if($handle->uploaded){ | |||
|         echo $handle->error; | ||||
|     } | ||||
| 
 | ||||
|     if($config['jpg_zip_php']>0 && $handle->file_dst_name_ext=='jpg'){         | ||||
|         $file = __DIR__.config_path().$handle->file_dst_name; | ||||
|         $percent = $config['jpg_zip_php'];  //图片压缩比
 | ||||
|         list($width, $height) = getimagesize($file); //获取原图尺寸
 | ||||
|         //缩放尺寸
 | ||||
|         $newwidth = $width * $percent; | ||||
|         $newheight = $height * $percent; | ||||
|         $src_im = imagecreatefromjpeg($file); | ||||
|         $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|         imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|         imagejpeg($dst_im,$file); //输出压缩后的图片
 | ||||
|         imagedestroy($dst_im); | ||||
|         imagedestroy($src_im); | ||||
|     // 上传完成图片后调用imgcompress类压缩图片
 | ||||
|     if($config['imgcompress_percent']>0 && $handle->file_dst_name_ext!='gif'){ | ||||
|         $source = APP_ROOT.config_path().$handle->file_dst_name; // 原图
 | ||||
|         $dst_img = APP_ROOT.config_path().$handle->file_dst_name; //存放路径
 | ||||
|         $percent = $config['imgcompress_percent'];  #是否缩放压缩
 | ||||
|         $image = (new imgcompress($source,$percent))->compressImg($dst_img);             | ||||
|     } | ||||
|      | ||||
|     unset($handle); | ||||
| } | ||||
|  | @ -0,0 +1,130 @@ | |||
| <?php | ||||
|   | ||||
| /** | ||||
|  * 压缩类 | ||||
|  * 分享请保持网址。尊重别人劳动成果。谢谢。 | ||||
|  * 图片压缩类:通过缩放来压缩。如果要保持源图比例,把参数$percent保持为1即可。 | ||||
|  * 即使原比例压缩,也可大幅度缩小。数码相机4M图片。也可以缩为700KB左右。如果缩小比例,则体积会更小。 | ||||
|  * 结果:可保存、可直接显示。 | ||||
|  */ | ||||
| class imgcompress{ | ||||
|   | ||||
|        private $src; | ||||
|        private $image; | ||||
|        private $imageinfo; | ||||
|        private $percent = 0.5; | ||||
|        /** | ||||
|         * 图片压缩 | ||||
|         * @param $src 源图 | ||||
|         * @param float $percent  压缩比例 | ||||
|         */ | ||||
|        public function __construct($src, $percent=1) | ||||
|        { | ||||
|               $this->src = $src; | ||||
|               $this->percent = $percent; | ||||
|        } | ||||
|   | ||||
|   | ||||
|        /** 高清压缩图片 | ||||
|         * @param string $saveName  提供图片名(可不带扩展名,用源图扩展名)用于保存。或不提供文件名直接显示 | ||||
|         */ | ||||
|        public function compressImg($saveName='') | ||||
|        { | ||||
|               $this->_openImage(); | ||||
|               if(!empty($saveName)) $this->_saveImage($saveName);  //保存
 | ||||
|               else $this->_showImage(); | ||||
|        } | ||||
|   | ||||
|        /** | ||||
|         * 内部:打开图片 | ||||
|         */ | ||||
|        private function _openImage() | ||||
|        { | ||||
|               list($width, $height, $type, $attr) = getimagesize($this->src); | ||||
|               $this->imageinfo = array( | ||||
|                      'width'=>$width, | ||||
|                      'height'=>$height, | ||||
|                      'type'=>image_type_to_extension($type,false), | ||||
|                      'attr'=>$attr | ||||
|               ); | ||||
|               $fun = "imagecreatefrom".$this->imageinfo['type']; | ||||
|               $this->image = $fun($this->src); | ||||
|               $this->_thumpImage(); | ||||
|        } | ||||
|        /** | ||||
|         * 内部:操作图片 | ||||
|         */ | ||||
|        private function _thumpImage() | ||||
|        { | ||||
|               $new_width = $this->imageinfo['width'] * $this->percent; | ||||
|               $new_height = $this->imageinfo['height'] * $this->percent; | ||||
|               $image_thump = imagecreatetruecolor($new_width,$new_height); | ||||
|               //将原图复制带图片载体上面,并且按照一定比例压缩,极大的保持了清晰度
 | ||||
|               imagecopyresampled($image_thump,$this->image,0,0,0,0,$new_width,$new_height,$this->imageinfo['width'],$this->imageinfo['height']); | ||||
|               imagedestroy($this->image); | ||||
|               $this->image = $image_thump; | ||||
|        } | ||||
|        /** | ||||
|         * 输出图片:保存图片则用saveImage() | ||||
|         */ | ||||
|        private function _showImage() | ||||
|        { | ||||
|               header('Content-Type: image/'.$this->imageinfo['type']); | ||||
|               $funcs = "image".$this->imageinfo['type']; | ||||
|               $funcs($this->image); | ||||
|        } | ||||
|        /** | ||||
|         * 保存图片到硬盘: | ||||
|         * @param  string $dstImgName  1、可指定字符串不带后缀的名称,使用源图扩展名 。2、直接指定目标图片名带扩展名。 | ||||
|         */ | ||||
|        private function _saveImage($dstImgName) | ||||
|        { | ||||
|               if(empty($dstImgName)) return false; | ||||
|               $allowImgs = ['.jpg', '.jpeg', '.png', '.bmp', '.wbmp','.gif'];   //如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名
 | ||||
|               $dstExt =  strrchr($dstImgName ,"."); | ||||
|               $sourseExt = strrchr($this->src ,"."); | ||||
|               if(!empty($dstExt)) $dstExt =strtolower($dstExt); | ||||
|               if(!empty($sourseExt)) $sourseExt =strtolower($sourseExt); | ||||
|   | ||||
|               //有指定目标名扩展名
 | ||||
|               if(!empty($dstExt) && in_array($dstExt,$allowImgs)){ | ||||
|                      $dstName = $dstImgName; | ||||
|               }elseif(!empty($sourseExt) && in_array($sourseExt,$allowImgs)){ | ||||
|                      $dstName = $dstImgName.$sourseExt; | ||||
|               }else{ | ||||
|                      $dstName = $dstImgName.$this->imageinfo['type']; | ||||
|               } | ||||
|               $funcs = "image".$this->imageinfo['type']; | ||||
|               $funcs($this->image,$dstName); | ||||
|        } | ||||
|   | ||||
|        /** | ||||
|         * 销毁图片 | ||||
|         */ | ||||
|        public function __destruct(){ | ||||
|               imagedestroy($this->image); | ||||
|        } | ||||
|   | ||||
| } | ||||
| 
 | ||||
| /* 调用方法 | ||||
| $source = '1.jpg; // 原图
 | ||||
| $dst_img = '2.jpg'; //可加存放路径
 | ||||
| $percent = 1;  #原图压缩,不缩放
 | ||||
| $image = (new imgcompress($source,$percent))->compressImg($dst_img); | ||||
| ------------------------------------------------------------------------ | ||||
| // 原压缩设置,其实就是提取了上面类中的精华
 | ||||
| 
 | ||||
|        $file = __DIR__.config_path().$handle->file_dst_name; | ||||
|         $percent = $config['jpg_zip_php'];  //图片压缩比
 | ||||
|         list($width, $height) = getimagesize($file); //获取原图尺寸
 | ||||
|         //缩放尺寸
 | ||||
|         $newwidth = $width * $percent; | ||||
|         $newheight = $height * $percent; | ||||
|         $src_im = imagecreatefromjpeg($file); | ||||
|         $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|         imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|         imagejpeg($dst_im,$file); //输出压缩后的图片
 | ||||
|         imagedestroy($dst_im); | ||||
|         imagedestroy($src_im); | ||||
|  */ | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								favicon.ico
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								favicon.ico
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 3.3 KiB | 
							
								
								
									
										144
									
								
								file.php
								
								
								
								
							
							
						
						
									
										144
									
								
								file.php
								
								
								
								
							|  | @ -1,17 +1,18 @@ | |||
| <?php | ||||
| require __DIR__.'/libs/function.php'; | ||||
| require APP_ROOT.'/libs/class.upload.php'; | ||||
| require __DIR__ . '/libs/function.php'; | ||||
| require APP_ROOT . '/libs/class.upload.php'; | ||||
| require APP_ROOT . '/libs/WaterMask.php'; | ||||
| 
 | ||||
| // 检查是否开启api上传
 | ||||
| if($config['apiStatus']){header('Access-Control-Allow-Origin:*');} | ||||
| if ($config['apiStatus']) {header('Access-Control-Allow-Origin:*');} | ||||
| 
 | ||||
| $handle = new upload($_FILES['file'],'zh_CN'); | ||||
| $handle = new upload($_FILES['file'], 'zh_CN'); | ||||
| 
 | ||||
| if($handle->uploaded){ | ||||
| if ($handle->uploaded) { | ||||
|     // 允许上传的mime类型
 | ||||
|     $handle->allowed = array ('image/*'); | ||||
|     $handle->allowed = array('image/*'); | ||||
|     // 文件命名
 | ||||
|     $handle->file_new_name_body = uniqid(); | ||||
|     $handle->file_new_name_body = imgName(); | ||||
|     // 最大上传限制
 | ||||
|     $handle->file_max_sizes = $config['maxSize']; | ||||
|     // 最大宽度
 | ||||
|  | @ -21,40 +22,47 @@ if($handle->uploaded){ | |||
|     // 最小宽度
 | ||||
|     $handle->image_min_width = $config['minWidth']; | ||||
|     // 最小高度
 | ||||
|     $handle->image_min_height = $config['minHeight'];     | ||||
|     $handle->image_min_height = $config['minHeight']; | ||||
|     // 转换图片为指定格式
 | ||||
|     $handle->image_convert = $config['imgConvert']; | ||||
|     //PNG图片压缩
 | ||||
|     $handle->png_compression = $config['zipPNG']; | ||||
|     //JPEG图片压缩
 | ||||
|     $handle->jpeg_quality = $config['zipJPEG']; | ||||
|      | ||||
| 
 | ||||
|     //等比例缩减图片
 | ||||
|     if($config['imgRatio']){ | ||||
|     if ($config['imgRatio']) { | ||||
|         $handle->image_x = $config['image_x']; | ||||
|     } | ||||
|     // 存储图片路径:images/201807/
 | ||||
|     $handle->process(APP_ROOT . config_path()); | ||||
| 
 | ||||
|     // 设置水印
 | ||||
|     if ($config['watermark'] > 0){ | ||||
|         switch ($config['watermark']){ | ||||
|     if ($config['watermark'] > 0) { | ||||
|         switch ($config['watermark']) { | ||||
|             case 1: // 文字水印 过滤gif
 | ||||
|                 if (isAnimatedGif($handle->file_src_pathname)===0){ | ||||
|                     $handle->image_text = $config['waterText']; | ||||
|                     $handle->image_text_direction = $config['textDirection']; | ||||
|                     $handle->image_text_color = $config['textColor']; | ||||
|                     $handle->image_text_opacity = $config['textOpacity']; | ||||
|                     $handle->image_text_font = $config['textFont']; | ||||
|                     $handle->image_text_size = $config['textSize']; | ||||
|                     $handle->image_text_padding = $config['textPadding']; | ||||
|                     $handle->image_text_position = $config['waterPosition']; | ||||
|                 if (isAnimatedGif($handle->file_src_pathname) === 0) { | ||||
|                     $arr = [ | ||||
|                         #  水印图片路径(如果不存在将会被当成是字符串水印)
 | ||||
|                          'res' => $config['waterText'], | ||||
|                         #  水印显示位置
 | ||||
|                          'pos' => $config['waterPosition'], | ||||
|                         #  不指定name(会覆盖原图,也就是保存成thumb.jpeg)
 | ||||
|                          'name' => $handle->file_dst_pathname, | ||||
|                         'font' => $config['textFont'], | ||||
|                         'fontSize' => $config['textSize'], | ||||
|                         'color' => $config['textColor'], | ||||
|                     ]; | ||||
|                     Imgs::setWater($handle->file_dst_pathname, $arr); | ||||
|                 } | ||||
|                 break; | ||||
|             case 2: // 图片水印
 | ||||
|                 if (isAnimatedGif($handle->file_src_pathname)===0){ | ||||
|                     $handle->image_watermark             = $config['waterImg']; | ||||
|                     $handle->image_watermark_position    = $config['waterPosition']; | ||||
|                     $handle->image_watermark_no_zoom_in  = true; | ||||
|                     $handle->image_watermark_no_zoom_out = true; | ||||
|                 if (isAnimatedGif($handle->file_src_pathname) === 0) { | ||||
|                     $arr = [ | ||||
|                         #  水印图片路径(如果不存在将会被当成是字符串水印)
 | ||||
|                          'res' => $config['waterImg'], | ||||
|                         #  水印显示位置
 | ||||
|                          'pos' => $config['waterPosition'], | ||||
|                         #  不指定name(会覆盖原图,也就是保存成thumb.jpeg)
 | ||||
|                          'name' => $handle->file_dst_pathname, | ||||
|                     ]; | ||||
|                     Imgs::setWater($handle->file_dst_pathname, $arr); | ||||
|                 } | ||||
|                 break; | ||||
|             default: | ||||
|  | @ -63,42 +71,64 @@ if($handle->uploaded){ | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // 存储图片路径:images/201807/
 | ||||
|     $handle->process(APP_ROOT.config_path()); | ||||
| 
 | ||||
|     // 图片完整相对路径:images/201807/0ed7ccfd4dab9cbc.jpg
 | ||||
|     if ($handle->processed){		 | ||||
|     if ($handle->processed) { | ||||
|         header('Content-type:text/json'); | ||||
|         // 上传成功后返回json数据
 | ||||
|         $reJson = array ( | ||||
|             "result"    =>  'success', | ||||
|             "url"       =>  $config['domain'].config_path().$handle->file_dst_name, | ||||
|         ); | ||||
|         echo json_encode($reJson);		 | ||||
|         $handle->clean(); | ||||
|     }else{ | ||||
|         // 上传错误 返回错误信息
 | ||||
|         $reJson = array ( | ||||
|             "result"      =>  'failed', | ||||
|             "message"     =>  $handle->error | ||||
|         $reJson = array( | ||||
|             "result" => 'success', | ||||
|             "url" => $config['domain'] . config_path() . $handle->file_dst_name, | ||||
|         ); | ||||
|         echo json_encode($reJson); | ||||
|         echo $handle->error; | ||||
|         $handle->clean(); | ||||
|     } else { | ||||
|         // 上传错误 返回错误信息
 | ||||
|         $reJson = array( | ||||
|             "result" => 'failed', | ||||
|             "message" => $handle->error, | ||||
|         ); | ||||
|         echo json_encode($reJson,JSON_UNESCAPED_UNICODE); | ||||
|     } | ||||
| 
 | ||||
|     if($config['jpg_zip_php']>0 && $handle->file_dst_name_ext=='jpg'){         | ||||
|         $file = __DIR__.config_path().$handle->file_dst_name; | ||||
|         $percent = $config['jpg_zip_php'];  //图片压缩比
 | ||||
|         list($width, $height) = getimagesize($file); //获取原图尺寸
 | ||||
|      | ||||
|     // 利用 imagecreatefrom*压缩不太好用,不过可以预防病毒
 | ||||
|     if ($config['imgcompress_percent'] > 0 && $handle->file_dst_name_ext != 'gif') { | ||||
|         $percent = $config['imgcompress_percent']; //图片压缩比
 | ||||
|         list($width, $height) = getimagesize($handle->file_dst_pathname); //获取原图尺寸
 | ||||
|         //缩放尺寸
 | ||||
|         $newwidth = $width * $percent; | ||||
|         $newheight = $height * $percent; | ||||
|         $src_im = imagecreatefromjpeg($file); | ||||
|         $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|         imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|         imagejpeg($dst_im,$file); //输出压缩后的图片
 | ||||
|         imagedestroy($dst_im); | ||||
|         imagedestroy($src_im); | ||||
| 
 | ||||
|         if ($handle->file_dst_name_ext === 'jpg') { | ||||
|             $src_im = imagecreatefromjpeg($handle->file_dst_pathname); | ||||
|             $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|             imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|             imagejpeg($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
 | ||||
|             imagedestroy($dst_im); | ||||
|             imagedestroy($src_im); | ||||
|         } elseif ($handle->file_dst_name_ext === 'png') { | ||||
|             $src_im = imagecreatefrompng($handle->file_dst_pathname); | ||||
|             $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|             imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|             imagepng($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
 | ||||
|             imagedestroy($dst_im); | ||||
|             imagedestroy($src_im); | ||||
|         } elseif ($handle->file_dst_name_ext === 'gif') { | ||||
|             $src_im = imagecreatefromgif($handle->file_dst_pathname); | ||||
|             $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|             imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|             imagegif($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
 | ||||
|             imagedestroy($dst_im); | ||||
|             imagedestroy($src_im); | ||||
|         } elseif ($handle->file_dst_name_ext === 'wbmp') { | ||||
|             $src_im = imagecreatefromwbmp($handle->file_dst_pathname); | ||||
|             $dst_im = imagecreatetruecolor($newwidth, $newheight); | ||||
|             imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); | ||||
|             imagewbmp($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
 | ||||
|             imagedestroy($dst_im); | ||||
|             imagedestroy($src_im); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     unset($handle); | ||||
| } | ||||
							
								
								
									
										35
									
								
								index.php
								
								
								
								
							
							
						
						
									
										35
									
								
								index.php
								
								
								
								
							|  | @ -16,13 +16,15 @@ if (@$_GET['e']==1){ | |||
|           <div class="content"></div> | ||||
|           <button type="button" class="close">×</button> | ||||
|         </div> | ||||
|         <div class="uploader-files file-list file-list-lg" data-drag-placeholder="选择文件或将图片直接拖拽至此处"></div> | ||||
|         <div class="uploader-files file-list" data-drag-placeholder="Ctrl+V粘贴/选择文件/将图片直接拖拽至此处"></div> | ||||
|         <div class="uploader-actions"> | ||||
|           <div class="uploader-status pull-right text-muted"></div> | ||||
|           <button type="button" class="btn btn-link uploader-btn-browse"> | ||||
|             <i class="icon icon-plus"></i>选择文件</button> | ||||
|           <button type="button" class="btn btn-link uploader-btn-start"> | ||||
|             <i class="icon icon-cloud-upload"></i>开始上传</button> | ||||
|             <button type="button" class="btn btn-link uploader-btn-stop"> | ||||
|             <i class="icon icon-pause"></i>暂停上传</button> | ||||
|         </div> | ||||
|       </div> | ||||
|       <div class="col-md-8 col-md-offset-2"> | ||||
|  | @ -36,18 +38,28 @@ if (@$_GET['e']==1){ | |||
|           <li> | ||||
|             <a href="#" data-target="#tab2Content4" data-toggle="tab">HTML</a></li> | ||||
|         </ul> | ||||
|         <div class="tab-content"> | ||||
|         <div class="tab-content" align="right"> | ||||
|           <div class="tab-pane fade active in" id="tab2Content1"> | ||||
|             <pre class="pre-scrollable" style="text-align: center;min-height: 100px;" id="links"></pre> | ||||
|             <textarea class="form-control" style="text-align: center;min-height: 100px;" id="links" readonly></textarea> | ||||
|             <button id="btnLinks" class="btn copyBtn1" data-loading-text="已经复制链接..." style="margin-top:10px;"><i | ||||
|                 class="icon icon-copy"></i> 复制</button> | ||||
|           </div> | ||||
|           <div class="tab-pane fade" id="tab2Content2"> | ||||
|             <pre class="pre-scrollable" style="text-align: center;min-height: 100px;" id="bbscode"></pre> | ||||
|             <textarea class="form-control" style="text-align: center;min-height: 100px;" id="bbscode" | ||||
|               readonly></textarea> | ||||
|             <button id="btnBbscode" class="btn copyBtn2" data-loading-text="已经复制链接..." style="margin-top:10px;"><i | ||||
|                 class="icon icon-copy"></i> 复制</button> | ||||
|           </div> | ||||
|           <div class="tab-pane fade" id="tab2Content3"> | ||||
|             <pre class="pre-scrollable" style="text-align: center;min-height: 100px;" id="markdown"></pre> | ||||
|             <textarea class="form-control" style="text-align: center;min-height: 100px;" id="markdown" | ||||
|               readonly></textarea> | ||||
|             <button id="btnMarkDown" class="btn copyBtn3" data-loading-text="已经复制链接..." style="margin-top:10px;"><i | ||||
|                 class="icon icon-copy"></i> 复制</button> | ||||
|           </div> | ||||
|           <div class="tab-pane fade" id="tab2Content4"> | ||||
|             <pre class="pre-scrollable" style="text-align: center;min-height: 100px;" id="html"></pre> | ||||
|             <textarea class="form-control" style="text-align: center;min-height: 100px;" id="html" readonly></textarea> | ||||
|             <button id="btnHtml" class="btn copyBtn4" data-loading-text="已经复制链接..." style="margin-top:10px;"><i | ||||
|                 class="icon icon-copy"></i> 复制</button> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|  | @ -73,7 +85,7 @@ if (@$_GET['e']==1){ | |||
|     filters: { // 只允许上传图片或图标(.ico)
 | ||||
|       mime_types: [{ | ||||
|           title: '图片', | ||||
|           extensions: 'bmp,jpg,png,tif,gif,pcx,tga,svg,webp' | ||||
|           extensions: 'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,webp,ico' | ||||
|         }, | ||||
|         { | ||||
|           title: '图标', | ||||
|  | @ -93,20 +105,19 @@ if (@$_GET['e']==1){ | |||
|         console.log(responseObject.response); | ||||
|         var obj = JSON.parse(responseObject.response); //由JSON字符串转换为JSON对象
 | ||||
|         var links = document.getElementById("links"); | ||||
|         links.innerHTML += obj.url + "<br />"; | ||||
|         links.innerHTML += obj.url + "\n"; | ||||
| 
 | ||||
|         var bbscode = document.getElementById("bbscode"); | ||||
|         bbscode.innerHTML += "[img]" + obj.url + "[/img]<br />"; | ||||
|         bbscode.innerHTML += "[img]" + obj.url + "[/img]\n"; | ||||
| 
 | ||||
|         var markdown = document.getElementById("markdown"); | ||||
|         markdown.innerHTML += "<br />"; | ||||
|         markdown.innerHTML += "\n"; | ||||
| 
 | ||||
|         var html = document.getElementById("html"); | ||||
|         html.innerHTML += "<img src=\"" + obj.url + "\" /><br />"; | ||||
|         html.innerHTML += "<img src=\"" + obj.url + "\" />\n"; | ||||
|       } else { | ||||
|         return '上传失败。服务器返回了一个错误:' + responseObject.response; | ||||
|       } | ||||
| 
 | ||||
|     } | ||||
|   }); | ||||
| </script> | ||||
|  |  | |||
|  | @ -0,0 +1,310 @@ | |||
| <?php | ||||
| // https://blog.csdn.net/MyDream229/article/details/80009012
 | ||||
| class Imgs | ||||
| { | ||||
|     /** | ||||
|      * 取得图片宽 | ||||
|      * @param string $src 图片相对路径或绝对路径 | ||||
|      */ | ||||
|     public static function get_width($src) | ||||
|     { | ||||
|         return imagesx($src); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 取得图片高 | ||||
|      * @param string $src 图片相对路径或绝对路径 | ||||
|      */ | ||||
|     public static function get_height($src) | ||||
|     { | ||||
|         return imagesy($src); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 图片缩放函数 | ||||
|      * @param string $src 图片相对路径或绝对路径 | ||||
|      * @param int $w 缩略图宽 | ||||
|      * @param int $h 缩略图高 | ||||
|      * @return array code:状态。msg:提示信息 | ||||
|      **/ | ||||
|     public static function thumb($src, $w = null, $h = null) | ||||
|     { | ||||
|         if (empty($src)) { | ||||
|             return array('code' => false, 'msg' => '请指定$src'); | ||||
|         } | ||||
| 
 | ||||
|         $temp = pathinfo($src); | ||||
|         #  文件名
 | ||||
|         $name = $temp["basename"]; | ||||
|         #  文件所在的文件夹
 | ||||
|         $dir = $temp["dirname"]; | ||||
|         #  文件扩展名
 | ||||
|         $extension = $temp["extension"]; | ||||
|         #  缩略图保存路径,新的文件名为*.thumb.jpg
 | ||||
|         $savepath = "{$dir}/thumb_{$name}"; | ||||
| 
 | ||||
|         #  获取图片的基本信息
 | ||||
|         $info = getimagesize($src); | ||||
|         #  获取图片宽度
 | ||||
|         $width = $info[0]; | ||||
|         #  获取图片高度
 | ||||
|         $height = $info[1]; | ||||
|         if (!empty($w)) { | ||||
|             $temp_w = $w; #  计算原图缩放后的宽度
 | ||||
|             $temp_h = intval($height * ($w / $width)); #  计算原图缩放后的高度
 | ||||
|         } else { | ||||
|             $temp_w = intval($width * ($h / $height)); #  计算原图缩放后的宽度
 | ||||
|             $temp_h = $h; #  计算原图缩放后的高度
 | ||||
|         } | ||||
| 
 | ||||
|         #  创建画布
 | ||||
|         $temp_img = imagecreatetruecolor($temp_w, $temp_h); | ||||
|         switch ($info[2]) { | ||||
|             case 1: | ||||
|                 $im = imagecreatefromgif($src); | ||||
|                 imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); | ||||
|                 imagegif($temp_img, $savepath, 100); | ||||
|                 break; | ||||
|             case 2: | ||||
|                 $im = imagecreatefromjpeg($src); | ||||
|                 imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); | ||||
|                 imagejpeg($temp_img, $savepath, 100); | ||||
|                 break; | ||||
|             case 3: | ||||
|                 $im = imagecreatefrompng($src); | ||||
|                 imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); | ||||
|                 imagepng($temp_img, $savepath, 100); | ||||
|                 break; | ||||
|         } | ||||
|         imagedestroy($im); | ||||
|         return $savepath; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 图片添加水印 | ||||
|      * @param string $src  1、图片相对路径或绝对路径  2、以逗号隔开的宽高值('800,600') | ||||
|      * @param array  属性值: | ||||
|      * res:水印资源(1、图片相对路径或绝对路径,2、字符串) | ||||
|      * pos:图片水印添加的位置,取值范围:0~9 | ||||
|      * 0:随机位置,在1~8之间随机选取一个位置 | ||||
|      * 1:顶部居左 2:顶部居中 | ||||
|      * 3:顶部居右 4:左边居中 | ||||
|      * 5:图片中心 6:右边居中 | ||||
|      * 7:底部居左 8:底部居中 | ||||
|      * 9:底部居右 | ||||
|      * font:    字体库(相对路径或绝对路径) | ||||
|      * fontSize:文字大小 | ||||
|      * color:   水印文字的字体颜色(255,255,255) | ||||
|      * name:    图片保存名称 | ||||
|      * @return array    code:状态、 msg:提示信息、 url:图片地址 | ||||
|      **/ | ||||
|     public static function setWater($src, $arr = array()) | ||||
|     { | ||||
|         if (empty($src)) { | ||||
|             return array('code' => false, 'msg' => '请指定$src'); | ||||
|         } | ||||
| 
 | ||||
|         $def = array( | ||||
|             'res' => '小川编程', | ||||
|             'pos' => 7, | ||||
|             'font' => './1.ttf', | ||||
|             'fontSize' => 24, | ||||
|             'color' => '255,255,255,0', | ||||
|             'name' => null, | ||||
|         ); | ||||
|         $def = array_merge($def, $arr); | ||||
|         /** | ||||
|         判断$src是不是图片,不是就创建画布 | ||||
|          */ | ||||
|         if (!file_exists($src)) { | ||||
|             if (empty($def['name'])) { | ||||
|                 return array('code' => false, 'msg' => '请指定图片名称'); | ||||
|             } | ||||
| 
 | ||||
|             # 计算画布宽高
 | ||||
|             $obj = explode(',', $src); | ||||
|             if (count($obj) != 2) { | ||||
|                 return array('code' => false, | ||||
|                     'msg' => '请给正确的宽高,或你给的不是一个有效的地址!'); | ||||
|             } | ||||
| 
 | ||||
|             $srcImg_w = is_numeric($obj[0]) ? $obj[0] : 400; | ||||
|             $srcImg_h = is_numeric($obj[1]) ? $obj[1] : 300; | ||||
|             # 创建画布
 | ||||
|             $dst_img = @imagecreatetruecolor($srcImg_w, $srcImg_h); | ||||
|         } else { | ||||
|             #  获取图片信息
 | ||||
|             $srcInfo = @getimagesize($src); | ||||
|             $srcImg_w = $srcInfo[0]; | ||||
|             $srcImg_h = $srcInfo[1]; | ||||
|             if (empty($def['name'])) { | ||||
|                 $def['name'] = $src; | ||||
|             } | ||||
| 
 | ||||
|             #  动态的把图片导入内存中
 | ||||
|             switch ($srcInfo[2]) { | ||||
|                 case 1: | ||||
|                     $dst_img = imagecreatefromgif($src); | ||||
|                     break; | ||||
| 
 | ||||
|                 case 2: | ||||
|                     $dst_img = imagecreatefromjpeg($src); | ||||
|                     break; | ||||
| 
 | ||||
|                 case 3: | ||||
|                     $dst_img = imagecreatefrompng($src); | ||||
|                     break; | ||||
| 
 | ||||
|                 default: | ||||
|                     return array('code' => false, 'msg' => '目标图片类型错误'); | ||||
|                     exit; | ||||
|             } | ||||
|         } | ||||
|         /** | ||||
|         计算出水印宽高 | ||||
|          */ | ||||
|         if (!file_exists($def['res'])) { | ||||
|             if (!file_exists($def['font'])) { | ||||
|                 return array('code' => false, 'msg' => '字体库不存在'); | ||||
|             } | ||||
| 
 | ||||
|             $box = @imagettfbbox($def['fontSize'], 0, $def['font'], $def['res']); | ||||
|             $logow = max($box[2], $box[4]) - min($box[0], $box[6]); | ||||
|             $logoh = max($box[1], $box[3]) - min($box[5], $box[7]); | ||||
|         } else { | ||||
|             $resInfo = @getimagesize($def['res']); | ||||
|             $res_w = $resInfo[0]; | ||||
|             $res_h = $resInfo[1]; | ||||
|             if ($srcImg_w < $res_w || $srcImg_h < $res_h) { | ||||
|                 return array('code' => false, 'msg' => '水印图片过大'); | ||||
|             } | ||||
| 
 | ||||
|             #  动态的把图片导入内存中
 | ||||
|             switch ($resInfo[2]) { | ||||
|                 case 1: | ||||
|                     $markim = imagecreatefromgif($def['res']); | ||||
|                     break; | ||||
| 
 | ||||
|                 case 2: | ||||
|                     $markim = imagecreatefromjpeg($def['res']); | ||||
|                     break; | ||||
| 
 | ||||
|                 case 3: | ||||
|                     $markim = imagecreatefrompng($def['res']); | ||||
|                     break; | ||||
| 
 | ||||
|                 default: | ||||
|                     return array('code' => false, 'msg' => '水印图片类型错误'); | ||||
|                     exit; | ||||
|             } | ||||
|             $logow = $res_w; | ||||
|             $logoh = $res_h; | ||||
|         } | ||||
|         /** | ||||
|         计算水印显示位置 | ||||
|          */ | ||||
|         if ($def['pos'] == 0) { | ||||
|             $def['pos'] = rand(1, 9); | ||||
|         } | ||||
| 
 | ||||
|         switch ($def['pos']) { | ||||
|             case 1: | ||||
|                 $x = +10; | ||||
|                 $y = +10 + $def['fontSize']; | ||||
|                 break; | ||||
| 
 | ||||
|             case 2: | ||||
|                 $x = ($srcImg_w - $logow) / 2; | ||||
|                 $y = +10 + $def['fontSize']; | ||||
|                 break; | ||||
| 
 | ||||
|             case 3: | ||||
|                 $x = $srcImg_w - $logow - 10; | ||||
|                 $y = +10 + $def['fontSize']; | ||||
|                 break; | ||||
| 
 | ||||
|             case 4: | ||||
|                 $x = +10; | ||||
|                 $y = ($srcImg_h - $logoh) / 2 + $def['fontSize']; | ||||
|                 break; | ||||
| 
 | ||||
|             case 5: | ||||
|                 $x = ($srcImg_w - $logow) / 2; | ||||
|                 $y = ($srcImg_h - $logoh) / 2 + $def['fontSize']; | ||||
|                 break; | ||||
| 
 | ||||
|             case 6: | ||||
|                 $x = $srcImg_w - $logow - 10; | ||||
|                 $y = ($srcImg_h - $logoh) / 2 + $def['fontSize']; | ||||
|                 break; | ||||
| 
 | ||||
|             case 7: | ||||
|                 $x = +10; | ||||
|                 $y = $srcImg_h - $logoh + $def['fontSize'] - 10; | ||||
|                 break; | ||||
| 
 | ||||
|             case 8: | ||||
|                 $x = ($srcImg_w - $logow) / 2; | ||||
|                 $y = $srcImg_h - $logoh + $def['fontSize'] - 10; | ||||
|                 break; | ||||
| 
 | ||||
|             case 9: | ||||
|                 $x = $srcImg_w - $logow - 10; | ||||
|                 $y = $srcImg_h - $logoh + $def['fontSize'] - 10; | ||||
|                 break; | ||||
| 
 | ||||
|             default: | ||||
|                 return array('code' => false, 'msg' => '水印位置不支持'); | ||||
|                 exit; | ||||
|         } | ||||
|         /** | ||||
|         把图片水印或文字水印,加到目标图片中 | ||||
|          */ | ||||
|         if (file_exists($def['res'])) { | ||||
|             imagecopy($dst_img, $markim, $x, $y, 0, 0, $logow, $logoh); | ||||
|             imagedestroy($markim); | ||||
|         } else { | ||||
|             $rgb = explode(',', $def['color']); | ||||
|             if (count($rgb) != 4) { | ||||
|                 return array('code' => false, 'msg' => '请给正确的字体颜色'); | ||||
|             } | ||||
| 
 | ||||
|             if (!is_numeric($rgb[0]) || !is_numeric($rgb[1]) || !is_numeric($rgb[2]) || !is_numeric($rgb[3])) { | ||||
|                 return array('code' => false, 'msg' => '请给正确的字体颜色'); | ||||
|             } | ||||
| 
 | ||||
|             if ($rgb[0] > 255 || $rgb[1] > 255 || $rgb[2] > 255 || $rgb[3] > 127) { | ||||
|                 return array('code' => false, 'msg' => '请给正确的字体颜色'); | ||||
|             } | ||||
| 
 | ||||
|             $def['color'] = imagecolorallocatealpha($dst_img, $rgb[0], $rgb[1], $rgb[2], $rgb[3]); | ||||
|             imagettftext($dst_img, $def['fontSize'], 0, $x, | ||||
|                 $y, $def['color'], $def['font'], $def['res']); | ||||
|         } | ||||
|         /** | ||||
|         保存处理过的图片(有水印了的图片) | ||||
|          */ | ||||
|         $name = explode('.', $def['name']); | ||||
| 		$num = count($name)-1;		 | ||||
|         switch (strtolower($name[$num])) { | ||||
|             case 'jpeg': | ||||
|                 imagejpeg($dst_img, $def['name']); | ||||
|                 break; | ||||
|             case 'jpg': | ||||
|                 imagejpeg($dst_img, $def['name']); | ||||
|                 break; | ||||
|             case 'png': | ||||
|                 imagepng($dst_img, $def['name']); | ||||
|                 break; | ||||
|             case 'gif': | ||||
|                 imagegif($dst_img, $def['name']); | ||||
|                 break; | ||||
|             default: | ||||
|                 return array('code' => false, 'msg' => '保存图片类型有误'); | ||||
|                 break; | ||||
|         } | ||||
|         #  销毁图片内存资源
 | ||||
|         imagedestroy($dst_img); | ||||
|         return array('code' => true, 'msg' => '添加水印成功', 'url' => $def['name']); | ||||
|     } | ||||
| } | ||||
|  | @ -31,11 +31,13 @@ echo ' | |||
|     } | ||||
|   }); | ||||
|   </script> | ||||
|   <script src="./public/static/hm.js"></script> | ||||
|   <script src="public/static/paste.js"></script> | ||||
|   <script src="public/static/copy_btn.js"></script> | ||||
|   <script src="public/static/hm.js"></script> | ||||
|   <footer class="text-muted small col-md-12" style="text-align: center"> | ||||
|    '.showAD('bot').' | ||||
|   <hr /> | ||||
|       Copyright © 2018-'. date('Y').' EasyImage Powered By <code><a href="https://www.545141.com/easyimage.html" target="_blank">icret</a></code> Verson: '.$config['Version'].@$qqgroup.' | ||||
|       Copyright © 2018-'. date('Y').' EasyImage Powered By <code><a href="https://www.545141.com/easyimage2.html" target="_blank">icret</a></code> Verson: '.$config['Version'].@$qqgroup.' | ||||
|   </footer> | ||||
| </body> | ||||
| </html> | ||||
|  |  | |||
|  | @ -40,30 +40,26 @@ function checkLogin() { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| // 检查配置文件中目录是否存在是否可写
 | ||||
| // 检查配置文件中目录是否存在是否可写并创建相应目录
 | ||||
| 
 | ||||
| function config_path(){ | ||||
|     global $config; | ||||
|     $real_path = APP_ROOT.$config['path']; | ||||
|     if(!is_dir($real_path)){ | ||||
|         mkdir($real_path,0777,true); | ||||
|     }elseif(!is_writable($real_path)){ | ||||
|         chmod($real_path,0777); | ||||
|     } | ||||
|     //创建年目录
 | ||||
|     $real_path = $config['path'].date('Y'); | ||||
|     if(!is_dir($real_path)){ | ||||
|         mkdir($real_path,0777); | ||||
|     }elseif(!is_writable($real_path)){ | ||||
|         chmod($real_path,0777); | ||||
|     } | ||||
|     // 创建月目录
 | ||||
|     $real_path = $real_path.'/'.date('m'); | ||||
|     if(!is_dir($real_path)){ | ||||
|         mkdir($real_path,0777); | ||||
|     }elseif(!is_writable($real_path)){ | ||||
|         chmod($real_path,0777); | ||||
|     } | ||||
|     return $real_path.'/'; | ||||
| 	global $config; | ||||
| 	$img_path = $config['path'].date('Y').'/'.date('m').'/'.date('d'); | ||||
| 	 | ||||
| 	if (!is_dir($img_path)){ | ||||
| 		mkdir($img_path,0755,true); | ||||
| 	} | ||||
| 	 | ||||
| 	if (!is_writable($img_path)){ | ||||
| 		chmod($img_path,0755); | ||||
| 	} | ||||
| 	 | ||||
| 	return $img_path.'/'; | ||||
| } | ||||
| 
 | ||||
| // 图片重命名规则
 | ||||
| function imgName(){ | ||||
|     return base_convert(date('His').mt_rand(1024,10240),10,36); | ||||
| } | ||||
| 
 | ||||
|  // 设置广告
 | ||||
|  | @ -98,7 +94,8 @@ function static_cdn(){ | |||
|         <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js?v3.3.1"></script> | ||||
|         <script src="https://cdn.bootcss.com/zui/1.8.1/js/zui.min.js?v1.8.1"></script> | ||||
|         <script src="https://cdn.bootcss.com/zui/1.8.1/lib/uploader/zui.uploader.min.js?v1.8.1"></script> | ||||
|         <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/icret/easyImages@1.5.3/static/qrcode.min.js?v1"></script> | ||||
|         <script src="https://cdn.jsdelivr.net/gh/icret/easyImages@1.5.3/static/qrcode.min.js?v1"></script> | ||||
|         <script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js?v2.0.4"></script> | ||||
|         '; | ||||
| 
 | ||||
|     }else{ | ||||
|  | @ -111,6 +108,7 @@ function static_cdn(){ | |||
|         <script src="../public/static/zui/js/zui.min.js?v1.8.1"></script> | ||||
|         <script src="../public/static/zui/lib/uploader/zui.uploader.min.js?v1.8.1"></script> | ||||
|         <script src="../public/static/qrcode.min.js?v1.0"></script> | ||||
|         <script src="../public/static/clipboard.min.js?v2.0.4"></script> | ||||
|         '; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ echo ' | |||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <meta name="keywords" content="'.$config['keywords'].'" /> | ||||
|     <meta name="description" content="'.$config['description'].'" /> | ||||
|     <link rel="shortcut icon" href="favicon.ico"  type="image/x-icon" /> | ||||
|     <link rel="shortcut icon" href="../public/static/favicon.ico"  type="image/x-icon" /> | ||||
|     '.static_cdn().' | ||||
|     <style> | ||||
|         .uploader-files{ | ||||
|  | @ -25,7 +25,7 @@ echo ' | |||
|         <ul class="nav nav-pills"> | ||||
|             <li class="active"><a href="index.php">首页</a></li> | ||||
|             <li><a href="https://github.com/icret/easyImages2.0" target="_blank">GitHub<span class="label label-badge label-success"></span></a></li> | ||||
|             <li><a href="public/data/tinyfilemanager.php" target="_blank">管理<span class="label label-badge label-success"></span></a></li> | ||||
|             <li><a href="tinyfilemanager.php" target="_blank">管理<span class="label label-badge label-success"></span></a></li> | ||||
|             <li><a class="dropdown-toggle hidden-xs" data-toggle="dropdown" href="#">二维码<span class="caret"></span></a> | ||||
|                 <ul class="dropdown-menu"> | ||||
|                     <input id="text" type="hidden" value=""/> | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -0,0 +1,213 @@ | |||
| { | ||||
|   "appName": "Tiny File Manager", | ||||
|   "version": "2.3.5", | ||||
|   "newUpdate": "New Updates Available, Download new version <a href='https://github.com/prasathmani/tinyfilemanager/archive/master.zip' target='_blank'>here</a>", | ||||
|   "noUpdate": "No Updates Available", | ||||
|   "aceHelp": [ | ||||
|     "Save (Ctrl + S)", | ||||
|     "Find (Ctrl + F)", | ||||
|     "Undo (Ctrl + Z)", | ||||
|     "Redo (Ctrl + Y)", | ||||
|     "Go to Line (Ctrl + L)", | ||||
|     "<a href='https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts' target='_blank'>More Shortcuts</a>" | ||||
|   ], | ||||
|   "aceTheme": { | ||||
|     "bright": { | ||||
|       "chrome": "Chrome", | ||||
|       "clouds": "Clouds", | ||||
|       "crimson_editor": "Crimson Editor", | ||||
|       "dawn": "Dawn", | ||||
|       "dreamweaver": "Dreamweaver", | ||||
|       "eclipse": "Eclipse", | ||||
|       "github": "GitHub", | ||||
|       "iplastic": "IPlastic", | ||||
|       "solarized_light": "Solarized Light", | ||||
|       "textmate": "TextMate", | ||||
|       "tomorrow": "Tomorrow", | ||||
|       "xcode": "XCode", | ||||
|       "kuroir": "Kuroir", | ||||
|       "katzenmilch": "KatzenMilch", | ||||
|       "sqlserver": "SQL Server" | ||||
|     }, | ||||
|     "dark": { | ||||
|       "ambiance": "Ambiance", | ||||
|       "chaos": "Chaos", | ||||
|       "clouds_midnight": "Clouds Midnight", | ||||
|       "dracula": "Dracula", | ||||
|       "cobalt": "Cobalt", | ||||
|       "gruvbox": "Gruvbox", | ||||
|       "gob": "Green on Black", | ||||
|       "idle_fingers": "idle Fingers", | ||||
|       "kr_theme": "krTheme", | ||||
|       "merbivore": "Merbivore", | ||||
|       "merbivore_soft": "Merbivore Soft", | ||||
|       "mono_industrial": "Mono Industrial", | ||||
|       "monokai": "Monokai", | ||||
|       "pastel_on_dark": "Pastel on dark", | ||||
|       "solarized_dark": "Solarized Dark", | ||||
|       "terminal": "Terminal", | ||||
|       "tomorrow_night": "Tomorrow Night", | ||||
|       "tomorrow_night_blue": "Tomorrow Night Blue", | ||||
|       "tomorrow_night_bright": "Tomorrow Night Bright", | ||||
|       "tomorrow_night_eighties": "Tomorrow Night 80s", | ||||
|       "twilight": "Twilight", | ||||
|       "vibrant_ink": "Vibrant Ink" | ||||
|     } | ||||
|   }, | ||||
|   "aceMode": { | ||||
|     "javascript": "JavaScript", | ||||
|     "abap": "ABAP", | ||||
|     "abc": "ABC", | ||||
|     "actionscript": "ActionScript", | ||||
|     "ada": "ADA", | ||||
|     "apache_conf": "Apache Conf", | ||||
|     "asciidoc": "AsciiDoc", | ||||
|     "asl": "ASL", | ||||
|     "assembly_x86": "Assembly x86", | ||||
|     "autohotkey": "AutoHotKey", | ||||
|     "apex": "Apex", | ||||
|     "batchfile": "BatchFile", | ||||
|     "bro": "Bro", | ||||
|     "c_cpp": "C and C++", | ||||
|     "c9search": "C9Search", | ||||
|     "cirru": "Cirru", | ||||
|     "clojure": "Clojure", | ||||
|     "cobol": "Cobol", | ||||
|     "coffee": "CoffeeScript", | ||||
|     "coldfusion": "ColdFusion", | ||||
|     "csharp": "C#", | ||||
|     "csound_document": "Csound Document", | ||||
|     "csound_orchestra": "Csound", | ||||
|     "csound_score": "Csound Score", | ||||
|     "css": "CSS", | ||||
|     "curly": "Curly", | ||||
|     "d": "D", | ||||
|     "dart": "Dart", | ||||
|     "diff": "Diff", | ||||
|     "dockerfile": "Dockerfile", | ||||
|     "dot": "Dot", | ||||
|     "drools": "Drools", | ||||
|     "edifact": "Edifact", | ||||
|     "eiffel": "Eiffel", | ||||
|     "ejs": "EJS", | ||||
|     "elixir": "Elixir", | ||||
|     "elm": "Elm", | ||||
|     "erlang": "Erlang", | ||||
|     "forth": "Forth", | ||||
|     "fortran": "Fortran", | ||||
|     "fsharp": "FSharp", | ||||
|     "fsl": "FSL", | ||||
|     "ftl": "FreeMarker", | ||||
|     "gcode": "Gcode", | ||||
|     "gherkin": "Gherkin", | ||||
|     "gitignore": "Gitignore", | ||||
|     "glsl": "Glsl", | ||||
|     "gobstones": "Gobstones", | ||||
|     "golang": "Go", | ||||
|     "graphqlschema": "GraphQLSchema", | ||||
|     "groovy": "Groovy", | ||||
|     "haml": "HAML", | ||||
|     "handlebars": "Handlebars", | ||||
|     "haskell": "Haskell", | ||||
|     "haskell_cabal": "Haskell Cabal", | ||||
|     "haxe": "haXe", | ||||
|     "hjson": "Hjson", | ||||
|     "html": "HTML", | ||||
|     "html_elixir": "HTML (Elixir)", | ||||
|     "html_ruby": "HTML (Ruby)", | ||||
|     "ini": "INI", | ||||
|     "io": "Io", | ||||
|     "jack": "Jack", | ||||
|     "jade": "Jade", | ||||
|     "java": "Java", | ||||
|     "json": "JSON", | ||||
|     "jsoniq": "JSONiq", | ||||
|     "jsp": "JSP", | ||||
|     "jssm": "JSSM", | ||||
|     "jsx": "JSX", | ||||
|     "julia": "Julia", | ||||
|     "kotlin": "Kotlin", | ||||
|     "latex": "LaTeX", | ||||
|     "less": "LESS", | ||||
|     "liquid": "Liquid", | ||||
|     "lisp": "Lisp", | ||||
|     "livescript": "LiveScript", | ||||
|     "logiql": "LogiQL", | ||||
|     "lsl": "LSL", | ||||
|     "lua": "Lua", | ||||
|     "luapage": "LuaPage", | ||||
|     "lucene": "Lucene", | ||||
|     "makefile": "Makefile", | ||||
|     "markdown": "Markdown", | ||||
|     "mask": "Mask", | ||||
|     "matlab": "MATLAB", | ||||
|     "maze": "Maze", | ||||
|     "mel": "MEL", | ||||
|     "mixal": "MIXAL", | ||||
|     "mushcode": "MUSHCode", | ||||
|     "mysql": "MySQL", | ||||
|     "nix": "Nix", | ||||
|     "nsis": "NSIS", | ||||
|     "objectivec": "Objective-C", | ||||
|     "ocaml": "OCaml", | ||||
|     "pascal": "Pascal", | ||||
|     "perl": "Perl", | ||||
|     "perl6": "Perl 6", | ||||
|     "pgsql": "pgSQL", | ||||
|     "php_laravel_blade": "PHP (Blade Template)", | ||||
|     "php": "PHP", | ||||
|     "puppet": "Puppet", | ||||
|     "pig": "Pig", | ||||
|     "powershell": "Powershell", | ||||
|     "praat": "Praat", | ||||
|     "prolog": "Prolog", | ||||
|     "properties": "Properties", | ||||
|     "protobuf": "Protobuf", | ||||
|     "python": "Python", | ||||
|     "r": "R", | ||||
|     "razor": "Razor", | ||||
|     "rdoc": "RDoc", | ||||
|     "red": "Red", | ||||
|     "rhtml": "RHTML", | ||||
|     "rst": "RST", | ||||
|     "ruby": "Ruby", | ||||
|     "rust": "Rust", | ||||
|     "sass": "SASS", | ||||
|     "scad": "SCAD", | ||||
|     "scala": "Scala", | ||||
|     "scheme": "Scheme", | ||||
|     "scss": "SCSS", | ||||
|     "sh": "SH", | ||||
|     "sjs": "SJS", | ||||
|     "slim": "Slim", | ||||
|     "smarty": "Smarty", | ||||
|     "snippets": "snippets", | ||||
|     "soy_template": "Soy Template", | ||||
|     "space": "Space", | ||||
|     "sql": "SQL", | ||||
|     "sqlserver": "SQLServer", | ||||
|     "stylus": "Stylus", | ||||
|     "svg": "SVG", | ||||
|     "swift": "Swift", | ||||
|     "tcl": "Tcl", | ||||
|     "terraform": "Terraform", | ||||
|     "tex": "Tex", | ||||
|     "text": "Text", | ||||
|     "textile": "Textile", | ||||
|     "toml": "Toml", | ||||
|     "tsx": "TSX", | ||||
|     "twig": "Twig", | ||||
|     "typescript": "Typescript", | ||||
|     "vala": "Vala", | ||||
|     "vbscript": "VBScript", | ||||
|     "velocity": "Velocity", | ||||
|     "verilog": "Verilog", | ||||
|     "vhdl": "VHDL", | ||||
|     "visualforce": "Visualforce", | ||||
|     "wollok": "Wollok", | ||||
|     "xml": "XML", | ||||
|     "xquery": "XQuery", | ||||
|     "yaml": "YAML", | ||||
|     "django": "Django" | ||||
|   } | ||||
| } | ||||
|  | @ -0,0 +1,114 @@ | |||
| 
 | ||||
|   var copyBtn = document.getElementsByClassName('copyBtn1')[0]; | ||||
|   copyBtn.onclick = function () { | ||||
|     var copyVal = document.getElementById("links"); | ||||
|     copyVal.select(); | ||||
|     try { | ||||
|       if (document.execCommand('copy', false, null)) { | ||||
|         //success info
 | ||||
|         console.log("复制成功"); | ||||
|       } else { | ||||
|         //fail info
 | ||||
|         alert("复制失败"); | ||||
|       } | ||||
|     } catch (err) { | ||||
|       //fail info
 | ||||
|       alert(err); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   var copyBtn = document.getElementsByClassName('copyBtn2')[0]; | ||||
|   copyBtn.onclick = function () { | ||||
|     var copyVal = document.getElementById("bbscode"); | ||||
|     copyVal.select(); | ||||
|     try { | ||||
|       if (document.execCommand('copy', false, null)) { | ||||
|         //success info
 | ||||
|         console.log("复制成功"); | ||||
|       } else { | ||||
|         //fail info
 | ||||
|         alert("复制失败"); | ||||
|       } | ||||
|     } catch (err) { | ||||
|       //fail info
 | ||||
|       alert(err); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   var copyBtn = document.getElementsByClassName('copyBtn3')[0]; | ||||
|   copyBtn.onclick = function () { | ||||
|     var copyVal = document.getElementById("markdown"); | ||||
|     copyVal.select(); | ||||
|     try { | ||||
|       if (document.execCommand('copy', false, null)) { | ||||
|         //success info
 | ||||
|         console.log("复制成功"); | ||||
|       } else { | ||||
|         //fail info
 | ||||
|         alert("复制失败"); | ||||
|       } | ||||
|     } catch (err) { | ||||
|       //fail info
 | ||||
|       alert(err); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   var copyBtn = document.getElementsByClassName('copyBtn4')[0]; | ||||
|   copyBtn.onclick = function () { | ||||
|     var copyVal = document.getElementById("html"); | ||||
|     copyVal.select(); | ||||
|     try { | ||||
|       if (document.execCommand('copy', false, null)) { | ||||
|         //success info
 | ||||
|         console.log("复制成功"); | ||||
|       } else { | ||||
|         //fail info
 | ||||
|         alert("复制失败"); | ||||
|       } | ||||
|     } catch (err) { | ||||
|       //fail info
 | ||||
|       alert(err); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
|   // btn状态
 | ||||
|   $('#btnLinks').on('click', function () { | ||||
|     var $btn = $(this); | ||||
|     $btn.button('loading'); | ||||
| 
 | ||||
|     // 此处使用 setTimeout 来模拟你的复杂功能逻辑
 | ||||
|     setTimeout(function () { | ||||
|       $btn.button('reset'); | ||||
|     }, 2000); | ||||
|   }); | ||||
| 
 | ||||
|   $('#btnBbscode').on('click', function () { | ||||
|     var $btn = $(this); | ||||
|     $btn.button('loading'); | ||||
| 
 | ||||
|     // 此处使用 setTimeout 来模拟你的复杂功能逻辑
 | ||||
|     setTimeout(function () { | ||||
|       $btn.button('reset'); | ||||
|     }, 2000); | ||||
|   }); | ||||
| 
 | ||||
|   $('#btnMarkDown').on('click', function () { | ||||
|     var $btn = $(this); | ||||
|     $btn.button('loading'); | ||||
| 
 | ||||
|     // 此处使用 setTimeout 来模拟你的复杂功能逻辑
 | ||||
|     setTimeout(function () { | ||||
|       $btn.button('reset'); | ||||
|     }, 2000); | ||||
|   }); | ||||
| 
 | ||||
|   $('#btnHtml').on('click', function () { | ||||
|     var $btn = $(this); | ||||
|     $btn.button('loading'); | ||||
| 
 | ||||
|     // 此处使用 setTimeout 来模拟你的复杂功能逻辑
 | ||||
|     setTimeout(function () { | ||||
|       $btn.button('reset'); | ||||
|     }, 2000); | ||||
|   }); | ||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 7.9 KiB | 
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,54 @@ | |||
| /** | ||||
|  * 复制、截图 简单图床修改版 | ||||
|  */ | ||||
| (function () { | ||||
|     document.addEventListener('paste', function (e) { | ||||
|         var items = ((e.clipboardData || window.clipboardData).items) || []; | ||||
|         var file = null; | ||||
| 
 | ||||
|         if (items && items.length) { | ||||
|             for (var i = 0; i < items.length; i++) { | ||||
|                 if (items[i].type.indexOf('image') !== -1) { | ||||
|                     file = items[i].getAsFile(); | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (!file) { | ||||
|             alert('粘贴内容非图片!'); | ||||
|             return; | ||||
|         } | ||||
|         var formData = new FormData(); | ||||
|         formData.append('file', file); | ||||
| 
 | ||||
|         var xhr = new XMLHttpRequest(); | ||||
|         xhr.onload = function () { | ||||
|             try { | ||||
|                 var result = JSON.parse(this.responseText); | ||||
|                 if (result.result === 'success') { | ||||
|                     var links = document.getElementById("links"); | ||||
|                     links.innerHTML += result.url + "\n"; | ||||
| 
 | ||||
|                     var bbscode = document.getElementById("bbscode"); | ||||
|                     bbscode.innerHTML += "[img]" + result.url + "[/img]\n"; | ||||
| 
 | ||||
|                     var markdown = document.getElementById("markdown"); | ||||
|                     markdown.innerHTML += "\n"; | ||||
| 
 | ||||
|                     var html = document.getElementById("html"); | ||||
|                     html.innerHTML += "<img src=\"" + result.url + "\" />\n"; | ||||
|                 } else { | ||||
|                     alert('上传失败1'); | ||||
|                 } | ||||
|             } catch (e) { | ||||
|                 alert('上传失败2'); | ||||
|             } | ||||
|         }; | ||||
|         xhr.onerror = function () { | ||||
|             alert('上传失败3'); | ||||
|         }; | ||||
|         xhr.open('POST', './file.php', true); | ||||
|         xhr.send(formData); | ||||
|     }); | ||||
| })(); | ||||
|  | @ -1,6 +1,6 @@ | |||
| <?php | ||||
| 
 | ||||
| require_once '../../libs/function.php'; | ||||
| require_once 'libs/function.php'; | ||||
| tinyfilemanager(); | ||||
| 
 | ||||
| //Default Configuration
 | ||||
|  | @ -56,7 +56,7 @@ $ip_blacklist = array( | |||
| 
 | ||||
| // user specific directories
 | ||||
| // array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
 | ||||
| $directories_users = array('admin'=>'./'); | ||||
| $directories_users = array('admin'=>'i/'); | ||||
| 
 | ||||
| // Enable highlight.js (https://highlightjs.org/) on view's page
 | ||||
| $use_highlightjs = true; | ||||
|  | @ -98,7 +98,7 @@ $favicon_path = '?img=favicon'; | |||
| 
 | ||||
| // Array of files and folders excluded from listing
 | ||||
| // e.r array('myfile.html', 'personal-folder')
 | ||||
| $GLOBALS['exclude_items'] = array('tinyfilemanager.php','translation.json'); | ||||
| $GLOBALS['exclude_items'] = array('tinyfilemanager.php','public/static/translation.json'); | ||||
| 
 | ||||
| // Online office Docs Viewer
 | ||||
| // Availabe rules are 'google', 'microsoft' or false
 | ||||
|  | @ -2093,7 +2093,7 @@ function fm_get_parent_path($path) | |||
|  */ | ||||
| function fm_get_translations($tr) { | ||||
|     try { | ||||
|         $content = @file_get_contents('translation.json'); | ||||
|         $content = @file_get_contents('public/static/translation.json'); | ||||
|         if($content !== FALSE) { | ||||
|             $lng = json_decode($content, TRUE); | ||||
|             global $lang_list; | ||||
|  | @ -3340,7 +3340,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal'; | |||
|         }); | ||||
|     }); | ||||
|     //TFM Config
 | ||||
|     window.curi = "https://tinyfilemanager.github.io/config.json", window.config = null; | ||||
|     window.curi = "public/static/config.json", window.config = null; | ||||
|     function fm_get_config(){ if(!!window.name){ window.config = JSON.parse(window.name); } else { $.getJSON(window.curi).done(function(c) { if(!!c) { window.name = JSON.stringify(c), window.config = c; } }); }} | ||||
|     function template(html,options){ | ||||
|         var re=/<\%([^\%>]+)?\%>/g,reExp=/(^( )?(if|for|else|switch|case|break|{|}))(.*)?/g,code='var r=[];\n',cursor=0,match;var add=function(line,js){js?(code+=line.match(reExp)?line+'\n':'r.push('+line+');\n'):(code+=line!=''?'r.push("'+line.replace(/"/g,'\\"')+'");\n':'');return add}
 | ||||
		Loading…
	
		Reference in New Issue
	
	 icret
						icret