删除异域上传

pull/18/head
icret 2019-06-27 00:12:18 +08:00
parent 7910357113
commit b9fe97724b
17 changed files with 159 additions and 5935 deletions

View File

@ -2,10 +2,23 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="6935a589-a69e-4859-b244-568b82d978d5" name="默认更改列表" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/check.php" beforeDir="false" afterPath="$PROJECT_DIR$/check.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config.php" beforeDir="false" afterPath="$PROJECT_DIR$/config.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tinyfilemanager.php" beforeDir="false" afterPath="$PROJECT_DIR$/tinyfilemanager.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/config.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/file.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/libs/class.upload.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/libs/function.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/libs/imgcompress.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/libs/lang/class.upload.xx_XX.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/libs/lang/class.upload.zh_CN.gb-2312.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/libs/lang/class.upload.zh_CN.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/public/static/hkxzy.ttf" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/public/static/watermark.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/crossdomain/read.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/file.php" beforeDir="false" afterPath="$PROJECT_DIR$/file.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/index.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/libs/function.php" beforeDir="false" afterPath="$PROJECT_DIR$/libs/function.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -21,42 +34,56 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tinyfilemanager.php">
<entry file="file://$PROJECT_DIR$/file.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="654">
<caret line="27" column="76" selection-start-line="27" selection-start-column="76" selection-end-line="27" selection-end-column="76" />
<folding>
<element signature="n#style#0;n#textarea#0;n#!!top" expanded="true" />
<element signature="e#1#7#0" expanded="true" />
</folding>
<state relative-caret-position="855">
<caret line="90" column="5" selection-start-line="90" selection-start-column="5" selection-end-line="90" selection-end-column="5" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/check.php">
<entry file="file://$PROJECT_DIR$/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="650">
<caret line="25" column="5" selection-start-line="25" selection-start-column="5" selection-end-line="25" selection-end-column="5" />
<state relative-caret-position="78">
<caret line="9" column="36" selection-start-line="9" selection-start-column="36" selection-end-line="9" selection-end-column="36" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/libs/function.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="439">
<caret line="125" column="13" lean-forward="true" selection-start-line="125" selection-start-column="13" selection-end-line="125" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1115">
<caret line="83" column="52" selection-start-line="83" selection-start-column="52" selection-end-line="83" selection-end-column="52" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/libs/WaterMask.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="52">
<caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="18" column="16" lean-forward="true" selection-start-line="18" selection-start-column="16" selection-end-line="18" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="596">
<caret line="20" column="32" lean-forward="true" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="32" />
<first_editor relative-caret-position="388">
<caret line="96" column="10" selection-start-line="96" selection-start-column="10" selection-end-line="96" selection-end-column="10" />
</first_editor>
<second_editor />
</state>
@ -68,6 +95,7 @@
<component name="FindInProjectRecents">
<findStrings>
<find>.js</find>
<find>compress</find>
</findStrings>
</component>
<component name="Git.Settings">
@ -76,13 +104,16 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/test.php" />
<option value="$PROJECT_DIR$/libs/header.php" />
<option value="$PROJECT_DIR$/libs/footer.php" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/tinyfilemanager.php" />
<option value="$PROJECT_DIR$/check.php" />
<option value="$PROJECT_DIR$/libs/footer.php" />
<option value="$PROJECT_DIR$/file.php" />
<option value="$PROJECT_DIR$/libs/function.php" />
<option value="$PROJECT_DIR$/test.php" />
<option value="$PROJECT_DIR$/index.php" />
<option value="$PROJECT_DIR$/config.php" />
<option value="$PROJECT_DIR$/README.md" />
</list>
</option>
</component>
@ -91,37 +122,21 @@
<path value="$PROJECT_DIR$/../../php/php-7.1.13-nts" />
</include_path>
</component>
<component name="ProjectConfigurationFiles">
<option name="files">
<list>
<option value="$PROJECT_DIR$/.idea/EasyImages2.0.iml" />
<option value="$PROJECT_DIR$/.idea/misc.xml" />
<option value="$PROJECT_DIR$/.idea/php.xml" />
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
<option value="$PROJECT_DIR$/.idea/modules.xml" />
<option value="$PROJECT_DIR$/.idea/codeStyles/Project.xml" />
<option value="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" />
<option value="$PROJECT_DIR$/.idea/EasyImages2.0.iml" />
<option value="$PROJECT_DIR$/.idea/misc.xml" />
<option value="$PROJECT_DIR$/.idea/php.xml" />
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
<option value="$PROJECT_DIR$/.idea/modules.xml" />
<option value="$PROJECT_DIR$/.idea/codeStyles/Project.xml" />
<option value="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="83" />
<option name="y" value="297" />
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="570" />
<option name="y" value="72" />
<option name="width" value="1932" />
<option name="height" value="1066" />
<option name="height" value="1087" />
</component>
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="1" id="添加" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -138,15 +153,16 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="settings.editor.selected.configurable" value="configurable.group.editor" />
<property name="settings.editor.splitter.proportion" value="0.2" />
</component>
@ -184,23 +200,33 @@
<updated>1560938705595</updated>
<workItem from="1560938706662" duration="371000" />
<workItem from="1560939151180" duration="1037000" />
<workItem from="1560964225388" duration="759000" />
<workItem from="1560964225388" duration="863000" />
<workItem from="1561130577720" duration="28000" />
<workItem from="1561140923199" duration="52000" />
<workItem from="1561272975978" duration="6000" />
<workItem from="1561273128787" duration="8000" />
<workItem from="1561489019295" duration="905000" />
<workItem from="1561560280581" duration="19000" />
<workItem from="1561560373126" duration="2951000" />
<workItem from="1561563657674" duration="69000" />
<workItem from="1561565172255" duration="54000" />
<workItem from="1561565295297" duration="223000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2167000" />
<option name="totallyTimeSpent" value="6586000" />
</component>
<component name="ToolWindowManager">
<frame x="83" y="297" width="1932" height="1066" extended-state="0" />
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25587606" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.28731343" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info active="true" anchor="bottom" id="Find" order="1" visible="true" weight="0.3290461" />
<window_info anchor="bottom" id="Run" order="2" weight="0.3290461" />
<window_info anchor="bottom" id="Run" order="2" weight="0.32180294" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -222,17 +248,6 @@
<option name="version" value="1" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test.php" />
<entry file="file://$PROJECT_DIR$/libs/function.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2938">
<caret line="113" column="1" selection-start-line="113" selection-start-column="1" selection-end-line="113" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/libs/header.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
@ -240,23 +255,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/libs/footer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="366">
<caret line="36" selection-start-line="36" selection-end-line="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="596">
<caret line="20" column="32" lean-forward="true" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="32" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tinyfilemanager.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="654">
@ -275,10 +273,57 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/libs/footer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="832">
<caret line="32" column="11" selection-start-line="32" selection-start-column="11" selection-end-line="32" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/crossdomain/file.php" />
<entry file="file://$PROJECT_DIR$/test.php" />
<entry file="file://$PROJECT_DIR$/libs/WaterMask.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="52">
<caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1115">
<caret line="83" column="52" selection-start-line="83" selection-start-column="52" selection-end-line="83" selection-end-column="52" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/file.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="855">
<caret line="90" column="5" selection-start-line="90" selection-start-column="5" selection-end-line="90" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="18" column="16" lean-forward="true" selection-start-line="18" selection-start-column="16" selection-end-line="18" selection-end-column="16" />
<state relative-caret-position="78">
<caret line="9" column="36" selection-start-line="9" selection-start-column="36" selection-end-line="9" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/libs/function.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="439">
<caret line="125" column="13" lean-forward="true" selection-start-line="125" selection-start-column="13" selection-end-line="125" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="388">
<caret line="96" column="10" selection-start-line="96" selection-start-column="10" selection-end-line="96" selection-end-column="10" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>

View File

@ -1,6 +1,6 @@
![简单图床示例](https://img.545141.com/i/2019/06/14/pv2hm.png
![简单图床示例](https://i1.100024.xyz/public/data/2019/05/5ce6915f50a1a.png
"简单图床示例")
![简单图床示例](https://img.545141.com/i/2019/06/14/plyis.png
![简单图床示例](https://i1.100024.xyz/public/data/2019/05/5cecf12575f6e.png
"简单图床示例")
## EasyImage 简单图床
@ -91,6 +91,11 @@ header('Access-Control-Allow-Origin:https://A.com/')
指定域名可以限制别人上传图片!(并不能保证完全能防止,毕竟可以伪造)
---
* 2019-6-26 v2.0.2.0
- 精简压缩代码,使得不再压缩后变大
- 删除异域上传功能,不再支持异域上传
- 其他一些细节优化
* 2019-6-14 v2.0.1.9
- 增加复制链接按钮

View File

@ -5,8 +5,9 @@
* @author icret
* @email lemonim@qq.com
* @Github https://github.com/icret/easyImages
* @link https://www.545141.com/902.html
* @Review 2019-5-21 13:05:20
* 上传后请打开check.php先检查服务器配置更改密码等操作
* 上传后请打开check.php先检查服务器配置更改密码,更改域名等操作
*/
// 设置html为utf8
@ -35,18 +36,14 @@ $config = array(
'maxSize' => 5242880,
// 是否开启登录上传 开启:true 关闭false
'mustLogin' => false,
// 登录和管理密码
'password' => 'admin',
// 是否开启管理
'tinyfilemanager' => true,
// 登录上传密码和管理密码 管理的管理员账号admin 密码为下面密码
'password' => 'admin',
// 是否开启API上传
'apiStatus' => false,
// 是否开启异域上传 开启true 关闭 false
'crossdomain' => false,
// 异域上传域名 末尾需要加'/'
'CDomains' => 'https://img.545141.com/crossdomain/',
// 是否开启水印:0关闭1文字水印2图片水印 动态gif不能添加水印
'watermark' => 1,
'watermark' => 0,
// 水印文字内容
'waterText' => '简单图床 img.545141.com',
/**
@ -64,15 +61,10 @@ $config = array(
'textFont' => APP_ROOT . '/public/static/hkxzy.ttf',
// 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha
'waterImg' => 'public/static/watermark.png',
// 允许上传的图片扩展名
'extensions'=>array('bmp','jpg','png','tif','gif','pcx','tga','svg','webp','jpeg','tga','svg','ico'),
// 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
'imgConvert' => '',
// 是否通过缩放来压缩,如果要保持源图比例,把参数$percent保持为1范围 0.1-1 0为关闭
// 即使原比例压缩,也可大幅度缩小。如果缩小比例,则体积会更小。
'compress' => 0.99,
// gif和jpeg的压缩质量 压缩等级0-100压缩后1最小100最大
'imgGifJpgWebp'=> 85,
// png的压缩质量 压缩等级0-9压缩后9最小0最大
'imagepng' => 3,
//最大宽度
'maxWidth' => 10240,
// 最大高度
@ -93,5 +85,5 @@ $config = array(
'ad_top' => false,
// 开启底部广告 如果想添加或修改广告请到 public/static/ad_bot.html
'ad_bot' => false,
'Version' => '2.0.1.9',
'Version' => '2.0.2.0',
);

View File

@ -1,94 +0,0 @@
<?php
/**
* EasyImage - 简单图床异域存储配置
*
* @author icret
* @email lemonim@qq.com
* @Github https://github.com/icret/easyImages
* @Review 2019-5-21 13:05:20
* 上传后请打开check.php先检查服务器配置更改密码等操作
*/
// 设置html为utf8
header('Content-Type:text/html;charset=utf-8');
//将时区设置为上海时区
ini_set('date.timezone', 'Asia/Shanghai');
// 修改内存限制 根据服务器配置选择低于128M容易出现上传失败你懂得图片挺占用内存的
ini_set('memory_limit','512M');
// 定义当前目录
define('APP_ROOT', __DIR__);
$config = array(
// 网站标题
'title' => '简单图床 - EasyImage',
// 网站关键字
'keywords' => '简单图床,easyimage,无数据库图床',
// 网站描述
'description' => '支持多文件上传,远程上传,api上传,简单无数据库,直接返回图片url,markdown,bbscode的一款html5图床程序 。',
// 网站公告
'tips' => ' 单个文件限制5M每次最多上传30张图片。',
// 当前域名,末尾不加"/" 如果是异域上传请修改为当前异域域名
'domain' => 'https://img.545141.com/crossdomain',
// 存储路径 末尾需要加"/"
'path' => '/public/data/',
// 最大上传限制 默认为5m 请使用工具转换mb http://www.bejson.com/convert/filesize/
'maxSize' => 5242880,
// 是否开启登录上传 开启:true 关闭false
'mustLogin' => false,
// 登录密码 此密码非管理密码
'password'=>'7070',
// 开启管理 开启后务必修改密码 修改方式请见read.php
'tinyfilemanager' => true,
// 是否开启API上传
'apiStatus' => true,
// 是否开启异域上传 开启true 关闭 false
'crossdomain'=>false,
// 异域上传域名 末尾需要加'/'
'CDomains'=>'https://img.545141.com/crossdomain/',
// 是否开启水印:0关闭1文字水印2图片水印 动态gif不能添加水印
'watermark' => 2,
// 水印文字内容
'waterText' => 'img.545141.com',
// 水印位置 T=topB =bottomL=leftR=right 'TBLR'中的一个或两个的组合
'waterPosition' => 'TB',
// 水印文字方向 h水平 v垂直
'textDirection' => 'h',
// 水印文字颜色
'textColor' => '#778899',
// 水印文字大小
'textSize' => 16,
// 字体路径 如果想改变字体,请选择支持中文的 gb2312
'textFont' => APP_ROOT.'/public/static/hkxzy.ttf',
// 水印边距 px
'textPadding' => 10,
// 水印透明度
'textOpacity' => 100,
// 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha
'waterImg' => 'public/static/watermark.png',
// 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
'imgConvert' => '',
// 是否通过缩放来压缩,如果要保持源图比例,把参数$percent保持为1范围 0.1-1
// 即使原比例压缩,也可大幅度缩小。如果缩小比例,则体积会更小。
'imgcompress_percent' => 0.9,
//最大宽度
'maxWidth' => 10240,
// 最大高度
'maxHeight' => 10240,
// 最小宽度
'minWidth' => 5,
// 最小高度
'minHeight' => 5,
// 等比例缩小图片 宽度和高度请设置 image_x image_y 开启true关闭false 关闭下mage_x和image_y设置不生效
'imgRatio' => false,
// 缩减的最大高度
'image_x' => 1024,
// 缩减的最大宽度
'image_y' => 1024,
// 开启静态文件CDN 开启true 关闭false
'static_cdn' => true,
// 开启顶部广告 如果想添加或修改广告请到 public/static/ad_top.html
'ad_top' => false,
// 开启底部广告 如果想添加或修改广告请到 public/static/ad_bot.html
'ad_bot' => false,
'Version' => '2.0.0.9'
);

View File

@ -1,94 +0,0 @@
<?php
require __DIR__.'/libs/function.php';
require APP_ROOT.'/libs/class.upload.php';
// 开启异域上传
header('Access-Control-Allow-Origin:*');
$handle = new upload($_FILES['file'],'zh_CN');
if($handle->uploaded){
// 允许上传的mime类型
$handle->allowed = array ('image/*');
// 文件命名
$handle->file_new_name_body = uniqid();
// 最大上传限制
$handle->file_max_sizes = $config['maxSize'];
// 最大宽度
$handle->image_max_width = $config['maxWidth'];
// 最大高度
$handle->image_max_height = $config['maxHeight'];
// 最小宽度
$handle->image_min_width = $config['minWidth'];
// 最小高度
$handle->image_min_height = $config['minHeight'];
// 转换图片为指定格式
$handle->image_convert = $config['imgConvert'];
//等比例缩减图片
if($config['imgRatio']){
$handle->image_x = $config['image_x'];
}
// 设置水印
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'];
}
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;
}
break;
default:
echo $handle->error;
break;
}
}
// 存储图片路径:images/201807/
$handle->process(APP_ROOT.config_path());
// 图片完整相对路径:images/201807/0ed7ccfd4dab9cbc.jpg
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
);
echo json_encode($reJson);
echo $handle->error;
}
// 上传完成图片后调用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);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,135 +0,0 @@
<?php
require __DIR__.'/../config.php';
// 判断GIF图片是否为动态
function isAnimatedGif($filename) {
$fp = fopen($filename, 'rb');
$filecontent = fread($fp, filesize($filename));
fclose($fp);
return strpos($filecontent, chr(0x21) . chr(0xff) . chr(0x0b) . 'NETSCAPE2.0') === FALSE ? 0 : 1;
}
// 校验登录
function checkLogin() {
global $config;
if (!empty( $_POST['password'] ) ) {
if ( $_POST['password'] == $config['password'] ) {
$psw = $_POST['password'];
setcookie('admin',$psw);
echo '<code>登录成功</code>';
}else{
echo '<code>密码错误</code>';
exit( include __DIR__ . '/login.php' );
}
} elseif (!empty( $_COOKIE['admin'] ) ) {
if ( $_COOKIE['admin'] == $config['password'] ) {
}
} else {
echo '<code>请登录</code>';
header('loction:login.php');
exit(include __DIR__.'/login.php');
}
}
// 仅允许登录后上传
function mustLogin(){
global $config;
if ($config['mustLogin']){
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.'/';
}
// 设置广告
function showAD($where) {
global $config;
switch ($where){
case 'top':
if ($config['ad_top']){
include (APP_ROOT.'/public/static/ad_top.html');
}
break;
case 'bot':
if ($config['ad_bot']){
include (APP_ROOT.'/public/static/ad_bot.html');
}
break;
default:
echo '广告函数出错';
break;
}
}
// 设置一键CDN
function static_cdn(){
global $config;
if ($config['static_cdn']){
// 开启CDN
return '
<link href="https://cdn.bootcss.com/zui/1.8.1/css/zui.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/zui/1.8.1/lib/uploader/zui.uploader.min.css" rel="stylesheet">
<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>
';
}else{
// 本地文件
return '
<link href="../public/static/zui/css/zui.min.css?v1.8.1" rel="stylesheet">
<link href="../public/static/zui/lib/uploader/zui.uploader.min.css?v1.8.1" rel="stylesheet">
<script src="../public/static/jquery.min.js?v3.3.1"></script>
<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>
';
}
}
// 开启管理
function tinyfilemanager(){
global $config;
if(!$config['tinyfilemanager']){
header('Location: '.$config['domain'].'?not_open_manager');
exit;
}
}
// 异域上传
function crossdomain(){
global $config;
if($config['crossdomain']){
return $config['CDomains'];
}
}
$qqgroup = ' <a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="EasyImage 简单图床" title="EasyImage 简单图床"></a>';

View File

@ -1,130 +0,0 @@
<?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);
*/

View File

@ -1,88 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.xx_XX.php |
// +------------------------------------------------------------------------+
// | Copyright (c) xxxxxx 200x. All rights reserved. |
// | Version 0.25 |
// | Last modified xx/xx/200x |
// | Email xxx@xxx.xxx |
// | Web http://www.xxxx.xxx |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload xxxxxx translation
*
* @version 0.28
* @author xxxxxxxx (xxx@xxx.xxx)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright xxxxxxxx
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = 'File error. Please try again.';
$translation['local_file_missing'] = 'Local file doesn\'t exist.';
$translation['local_file_not_readable'] = 'Local file is not readable.';
$translation['uploaded_too_big_ini'] = 'File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini).';
$translation['uploaded_too_big_html'] = 'File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form).';
$translation['uploaded_partial'] = 'File upload error (the uploaded file was only partially uploaded).';
$translation['uploaded_missing'] = 'File upload error (no file was uploaded).';
$translation['uploaded_no_tmp_dir'] = 'File upload error (missing a temporary folder).';
$translation['uploaded_cant_write'] = 'File upload error (failed to write file to disk).';
$translation['uploaded_err_extension'] = 'File upload error (file upload stopped by extension).';
$translation['uploaded_unknown'] = 'File upload error (unknown error code).';
$translation['try_again'] = 'File upload error. Please try again.';
$translation['file_too_big'] = 'File too big.';
$translation['no_mime'] = 'MIME type can\'t be detected.';
$translation['incorrect_file'] = 'Incorrect type of file.';
$translation['image_too_wide'] = 'Image too wide.';
$translation['image_too_narrow'] = 'Image too narrow.';
$translation['image_too_high'] = 'Image too high.';
$translation['image_too_short'] = 'Image too short.';
$translation['ratio_too_high'] = 'Image ratio too high (image too wide).';
$translation['ratio_too_low'] = 'Image ratio too low (image too high).';
$translation['too_many_pixels'] = 'Image has too many pixels.';
$translation['not_enough_pixels'] = 'Image has not enough pixels.';
$translation['file_not_uploaded'] = 'File not uploaded. Can\'t carry on a process.';
$translation['already_exists'] = '%s already exists. Please change the file name.';
$translation['temp_file_missing'] = 'No correct temp source file. Can\'t carry on a process.';
$translation['source_missing'] = 'No correct uploaded source file. Can\'t carry on a process.';
$translation['destination_dir'] = 'Destination directory can\'t be created. Can\'t carry on a process.';
$translation['destination_dir_missing'] = 'Destination directory doesn\'t exist. Can\'t carry on a process.';
$translation['destination_path_not_dir'] = 'Destination path is not a directory. Can\'t carry on a process.';
$translation['destination_dir_write'] = 'Destination directory can\'t be made writeable. Can\'t carry on a process.';
$translation['destination_path_write'] = 'Destination path is not a writeable. Can\'t carry on a process.';
$translation['temp_file'] = 'Can\'t create the temporary file. Can\'t carry on a process.';
$translation['source_not_readable'] = 'Source file is not readable. Can\'t carry on a process.';
$translation['no_create_support'] = 'No create from %s support.';
$translation['create_error'] = 'Error in creating %s image from source.';
$translation['source_invalid'] = 'Can\'t read image source. Not an image?.';
$translation['gd_missing'] = 'GD doesn\'t seem to be present.';
$translation['watermark_no_create_support'] = 'No create from %s support, can\'t read watermark.';
$translation['watermark_create_error'] = 'No %s read support, can\'t create watermark.';
$translation['watermark_invalid'] = 'Unknown image format, can\'t read watermark.';
$translation['file_create'] = 'No %s create support.';
$translation['no_conversion_type'] = 'No conversion type defined.';
$translation['copy_failed'] = 'Error copying file on the server. copy() failed.';
$translation['reading_failed'] = 'Error reading the file.';
?>

View File

@ -1,86 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email caoshiwei@gmail.com |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @codepage gb-2312
* @author Shiwei Cao (caoshiwei@gmail.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>';
$translation['local_file_missing'] = '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>';
$translation['local_file_not_readable'] = '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɶ<EFBFBD><C9B6>';
$translation['uploaded_too_big_ini'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>php.ini<6E><69>upload_max_filesize<7A><65><EFBFBD>õĴ<C3B5>С)<29><>';
$translation['uploaded_too_big_html'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HTML <20><><EFBFBD><EFBFBD><EFBFBD>õĴ<C3B5>С)<29><>';
$translation['uploaded_partial'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ֶ<EFBFBD>ʧ)<29><>';
$translation['uploaded_missing'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4>ļ<EFBFBD><C4BC><EFBFBD>ʧ)<29><>';
$translation['uploaded_unknown'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (δ֪<CEB4><D6AA><EFBFBD><EFBFBD>).';
$translation['try_again'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>';
$translation['file_too_big'] = '<27>ļ<EFBFBD>̫<EFBFBD><CCAB><EFBFBD><EFBFBD>';
$translation['no_mime'] = 'δ֪<CEB4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>͡<EFBFBD>';
$translation['incorrect_file'] = '<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ<EFBFBD><CABD>';
$translation['image_too_wide'] = 'ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>̫<EFBFBD><CCAB><EFBFBD><EFBFBD>';
$translation['image_too_narrow'] = 'ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>̫С<CCAB><D0A1>';
$translation['image_too_high'] = 'ͼƬ<CDBC>߶<EFBFBD>̫<EFBFBD><CCAB><EFBFBD><EFBFBD>';
$translation['image_too_short'] = 'ͼƬ<CDBC>߶<EFBFBD>̫С<CCAB><D0A1>';
$translation['ratio_too_high'] = 'ͼƬ<CDBC><C6AC>/<2F>߱<EFBFBD><DFB1><EFBFBD>̫<EFBFBD><CCAB>(ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>̫<EFBFBD><CCAB>)<29><>';
$translation['ratio_too_low'] = 'ͼƬ<CDBC><C6AC>/<2F>߱<EFBFBD><DFB1><EFBFBD>̫<EFBFBD><CCAB>(ͼƬ<CDBC>߶<EFBFBD>̫<EFBFBD><CCAB>).';
$translation['too_many_pixels'] = 'ͼƬλ<C6AC><CEBB>̫<EFBFBD>ߡ<EFBFBD>';
$translation['not_enough_pixels'] = 'ͼƬλ<C6AC><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['file_not_uploaded'] = '<27>ļ<EFBFBD>δ<EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['already_exists'] = '%s <20>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>';
$translation['temp_file_missing'] = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>ʱ)Դ<>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['source_missing'] = '<27><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_dir'] = 'Ŀ<><C4BF><EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_dir_missing'] = 'Ŀ<><C4BF><EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_path_not_dir'] = 'Ŀ¼·<C2BC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_dir_write'] = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_path_write'] = 'Ŀ¼·<C2BC><C2B7><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['temp_file'] = '<27><><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['source_not_readable'] = <>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['no_create_support'] = '%s <20><>֧<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>';
$translation['create_error'] = '<27><>Դ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> %s ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>';
$translation['source_invalid'] = '<27>޷<EFBFBD><DEB7><EFBFBD>ȡԭʼͼƬ<CDBC><C6AC>ȷ<EFBFBD><C8B7><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ͼƬ<CDBC>ļ<EFBFBD><C4BC><EFBFBD>';
$translation['gd_missing'] = 'GD <20><><EFBFBD>񲻿<EFBFBD><F1B2BBBF><EFBFBD>ʹ<EFBFBD>á<EFBFBD>';
$translation['watermark_no_create_support'] = '%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>, <20><><EFBFBD>ܶ<EFBFBD>ȡˮӡ<CBAE>ļ<EFBFBD><C4BC><EFBFBD>';
$translation['watermark_create_error'] = '%s <20><>֧<EFBFBD>ֶ<EFBFBD>, <20><><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>ˮӡ<CBAE><D3A1>';
$translation['watermark_invalid'] = 'δ֪<CEB4>ļ<EFBFBD><C4BC><EFBFBD>ʽ, <20>޷<EFBFBD><DEB7><EFBFBD>ȡˮӡ<CBAE>ļ<EFBFBD><C4BC><EFBFBD>';
$translation['file_create'] = '%s <20><>֧<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>';
$translation['no_conversion_type'] = <><CEB4><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['copy_failed'] = '<27>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> copy() <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.';
$translation['reading_failed'] = '<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>';
?>

View File

@ -1,85 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email caoshiwei@gmail.com |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @author Shiwei Cao (caoshiwei@gmail.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '文件错误,请重试。';
$translation['local_file_missing'] = '本地文件不存在。';
$translation['local_file_not_readable'] = '本地文件不可读。';
$translation['uploaded_too_big_ini'] = '文件上件出错 (上传的文件大小超过了php.ini中upload_max_filesize设置的大小)。';
$translation['uploaded_too_big_html'] = '文件上件出错 (上传的文件大小超过了HTML 表单设置的大小)。';
$translation['uploaded_partial'] = '文件上件出错 (上传的文件部分丢失)。';
$translation['uploaded_missing'] = '文件上件出错 (上传文件丢失)。';
$translation['uploaded_unknown'] = '文件上件出错 (未知错误).';
$translation['try_again'] = '文件上件出错。 请重试。';
$translation['file_too_big'] = '文件太大。';
$translation['no_mime'] = '未知文件类型。';
$translation['incorrect_file'] = '不正确的文件格式。';
$translation['image_too_wide'] = '图片宽度太大。';
$translation['image_too_narrow'] = '图片宽度太小。';
$translation['image_too_high'] = '图片高度太大。';
$translation['image_too_short'] = '图片高度太小。';
$translation['ratio_too_high'] = '图片宽/高比率太高(图片宽度太大)。';
$translation['ratio_too_low'] = '图片宽/高比率太低(图片高度太大).';
$translation['too_many_pixels'] = '图片位数太高。';
$translation['not_enough_pixels'] = '图片位数不够';
$translation['file_not_uploaded'] = '文件未上传,不能进行处理。';
$translation['already_exists'] = '%s 已经存在,请更换文件名。';
$translation['temp_file_missing'] = '处理的(临时)源文件不正确,不能进行处理。';
$translation['source_missing'] = '已上传的文件丢失,不能进行处理。';
$translation['destination_dir'] = '目标文件目录不能被创建,不能进行处理。';
$translation['destination_dir_missing'] = '目标文件目录不存在,不能进行处理。';
$translation['destination_path_not_dir'] = '目录路径不是一个有效的目录,不能进行处理。';
$translation['destination_dir_write'] = '不能让目标文件目录设置为可写的,不能进行处理。';
$translation['destination_path_write'] = '目录路径是不可以写的,不能进行处理。';
$translation['temp_file'] = '不能创建临时文件,不能进行处理。';
$translation['source_not_readable'] = '源文件不可以读,不能进行处理。';
$translation['no_create_support'] = '%s 不支持创建';
$translation['create_error'] = '从源文件创建 %s 图片过程中出错。';
$translation['source_invalid'] = '无法读取原始图片,确认是不是正确的图片文件?';
$translation['gd_missing'] = 'GD 好像不可以使用。';
$translation['watermark_no_create_support'] = '%s 创建不支持, 不能读取水印文件。';
$translation['watermark_create_error'] = '%s 不支持读, 不能创建水印。';
$translation['watermark_invalid'] = '未知文件格式, 无法读取水印文件。';
$translation['file_create'] = '%s 不支持创建。';
$translation['no_conversion_type'] = '未定义转换类型';
$translation['copy_failed'] = '在服务器上复制文件时出错。 copy() 操作失败.';
$translation['reading_failed'] = '读取过程中出错。';
?>

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -1 +0,0 @@
* 如果你不想使用异域上传可以删除本文件夹!

View File

@ -89,48 +89,5 @@ if ($handle->uploaded) {
);
echo json_encode($reJson,JSON_UNESCAPED_UNICODE);
}
// 利用 imagecreatefrom*压缩 同时避免设置水印后重复压缩
if ($config['compress'] > 0 && $handle->file_dst_name_ext != 'gif' && $config['watermark'] == 0) {
$percent = $config['compress']; //图片压缩比
list($width, $height) = getimagesize($handle->file_dst_pathname); //获取原图尺寸
//缩放尺寸
$newwidth = $width * $percent;
$newheight = $height * $percent;
// 创建一个透明的背景图片
$dst_im = imagecreatetruecolor($newwidth, $newheight);
$bg = imagecolorallocatealpha($dst_im, 0, 0, 0, 127);
imagefill($dst_im, 0, 0, $bg);
imagesavealpha($dst_im, true);
if ($handle->file_dst_name_ext === 'jpg' || $handle->file_dst_name_ext === 'jpeg') {
$src_im = imagecreatefromjpeg($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($dst_im, $handle->file_dst_pathname,$config['imgGifJpgWebp']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
} elseif ($handle->file_dst_name_ext === 'png') {
$src_im = imagecreatefrompng($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagepng($dst_im, $handle->file_dst_pathname,$config['imagepng']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
} elseif ($handle->file_dst_name_ext === 'gif') {
$src_im = imagecreatefromgif($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagegif($dst_im, $handle->file_dst_pathname,$config['imgGifJpgWebp']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
} elseif ($handle->file_dst_name_ext === 'wbmp') {
$src_im = imagecreatefromwbmp($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagewbmp($dst_im, $handle->file_dst_pathname,$config['imgGifJpgWebp']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
}
}
unset($handle);
}

View File

@ -70,13 +70,9 @@ if (@$_GET['e']==1){
// 当选择文件后立即自动进行上传操作
autoUpload: false,
// 文件上传提交地址
url: '<?php echo crossdomain();?>file.php',
//图片压缩
resize: {
quuality: 90,
},
url: 'file.php',
// 最大支持的上传文件
max_file_size: '5mb',
max_file_size: <?php echo $config['maxSize'];?>,
// 是否分片上传 0为不分片 经测试分片容易使图片上传失败
chunk_size: 0,
//点击文件列表上传文件
@ -85,7 +81,7 @@ if (@$_GET['e']==1){
filters: { // 只允许上传图片或图标(.ico
mime_types: [{
title: '图片',
extensions: 'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,webp,ico'
extensions: '<?php echo getExtensions();?>'
},
{
title: '图标',

View File

@ -122,12 +122,16 @@ function tinyfilemanager(){
}
}
// 异域上传
function crossdomain(){
// 获取允许上传的扩展名
function getExtensions(){
global $config;
if($config['crossdomain']){
return $config['CDomains'];
$mime = '';
for ($i=0;$i<count($config['extensions']);$i++)
{
$mime.=$config['extensions'][$i].',';
}
return rtrim($mime,',');
}
//$qqgroup = ' <a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="EasyImage 简单图床" title="EasyImage 简单图床"></a>';