You've already forked EasyImages2.0
mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-12-13 11:43:58 +08:00
优化
This commit is contained in:
@@ -274,12 +274,12 @@ if (isset($_POST['radio'])) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>上传前改变图片尺寸->更改后的宽度:</label><label id="image_x"><?php echo $config['image_x']; ?></label><label>像素</label>
|
||||
<input type="range" class="form-control" name="image_x" value="<?php echo $config['image_x']; ?>" min="100" max="10240" step="100" onchange="document.getElementById('image_x').innerHTML=value">
|
||||
<label>图片裁剪的宽度(设置0则不生效)->更改后的宽度:</label><label id="image_x"><?php echo $config['image_x']; ?></label><label>像素</label>
|
||||
<input type="range" class="form-control" name="image_x" value="<?php echo $config['image_x']; ?>" min="0" max="10240" step="100" onchange="document.getElementById('image_x').innerHTML=value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>上传前改变图片尺寸->更改后的高度:</label><label id="image_y"><?php echo $config['image_y']; ?></label><label>像素</label>
|
||||
<input type="range" class="form-control" name="image_y" value="<?php echo $config['image_y']; ?>" min="100" max="10240" step="100" onchange="document.getElementById('image_y').innerHTML=value">
|
||||
<label>图片裁剪的高度(设置0则不生效)->更改后的高度:</label><label id="image_y"><?php echo $config['image_y']; ?></label><label>像素</label>
|
||||
<input type="range" class="form-control" name="image_y" value="<?php echo $config['image_y']; ?>" min="0" max="10240" step="100" onchange="document.getElementById('image_y').innerHTML=value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="switch">
|
||||
@@ -292,11 +292,11 @@ if (isset($_POST['radio'])) {
|
||||
<div class="switch">
|
||||
<input type="hidden" name="imgRatio_preserve_headers" value="0">
|
||||
<input type="checkbox" name="imgRatio_preserve_headers" value="1" <?php if ($config['imgRatio_preserve_headers']) {echo 'checked="checked"';} ?>>
|
||||
<label style="font-weight: bold">压缩后是否保留图片原始数据</label>
|
||||
<label style="font-weight: bold">开启保留图片原始数据</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>上传前图片压缩率控制(仅支持JPG)->更改后的压缩率:</label><label id="imgRatio_quality"><?php echo $config['imgRatio_quality']; ?></label><label>%</label>
|
||||
<label>上传前压缩图片(仅支持JPG)->更改后的压缩率:</label><label id="imgRatio_quality"><?php echo $config['imgRatio_quality']; ?></label><label>%</label>
|
||||
<input type="range" class="form-control" name="imgRatio_quality" value="<?php echo $config['imgRatio_quality']; ?>" min="10" max="100" step="5" onchange="document.getElementById('imgRatio_quality').innerHTML=value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -113,7 +113,7 @@ function imgName()
|
||||
return sha1(microtime());
|
||||
break;
|
||||
default:
|
||||
return base_convert(date('His') . mt_rand(1024, 10240), 10, 36); // 将上传时间+随机数转换为36进制 例:vx77yu
|
||||
return base_convert(date('His') . mt_rand(1024, 9999), 10, 36); // 将上传时间+随机数转换为36进制 例:vx77yu
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ function imgRatio()
|
||||
{
|
||||
global $config;
|
||||
if ($config['imgRatio']) {
|
||||
echo $config['imgRatio'];
|
||||
|
||||
if ($config['imgRatio_crop'] === 1) {
|
||||
$imgRatio_crop = 'true';
|
||||
} else {
|
||||
@@ -430,10 +430,22 @@ echo $config['imgRatio'];
|
||||
$imgRatio_preserve_headers = 'false';
|
||||
}
|
||||
|
||||
if ($config['image_x'] != 0) {
|
||||
$image_x = "width:" . $config['image_x'];
|
||||
} else {
|
||||
$image_x = null;
|
||||
}
|
||||
|
||||
if ($config['image_y'] != 0) {
|
||||
$image_y = "height:" . $config['image_y'];
|
||||
} else {
|
||||
$image_y = null;
|
||||
}
|
||||
|
||||
return '
|
||||
resize:{
|
||||
width: ' . $config['image_x'] . ',
|
||||
height: ' . $config['image_y'] . ',
|
||||
' . $image_x . ',
|
||||
' . $image_y . ',
|
||||
crop: ' . $imgRatio_crop . ',
|
||||
quality:' . $config['imgRatio_quality'] . ',
|
||||
preserve_headers: ' . $imgRatio_preserve_headers . ',
|
||||
@@ -662,12 +674,13 @@ function writefile($filename, $writetext, $openmod = 'w')
|
||||
}
|
||||
}
|
||||
|
||||
function get_online_thumbnail($imgUrl){
|
||||
function get_online_thumbnail($imgUrl)
|
||||
{
|
||||
global $config;
|
||||
if($config['thumbnail']){
|
||||
if ($config['thumbnail']) {
|
||||
$imgUrl = str_replace($config['imgurl'], '', $imgUrl);
|
||||
return $config['domain'].'/application/thumb.php?img='.$imgUrl.'&width=300&height=300';
|
||||
}else{
|
||||
return $config['domain'] . '/application/thumb.php?img=' . $imgUrl . '&width=300&height=300';
|
||||
} else {
|
||||
return $imgUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ $config=Array
|
||||
'minWidth'=>5,
|
||||
'minHeight'=>5,
|
||||
'imgRatio'=>0,
|
||||
'image_x'=>800,
|
||||
'image_y'=>800,
|
||||
'imgRatio_quality'=>60,
|
||||
'imgRatio_crop'=>1,
|
||||
'image_x'=>2500,
|
||||
'image_y'=>2700,
|
||||
'imgRatio_quality'=>80,
|
||||
'imgRatio_crop'=>0,
|
||||
'imgRatio_preserve_headers'=>1,
|
||||
'static_cdn'=>0,
|
||||
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0',
|
||||
|
||||
BIN
public/images/image_icon_153794.png
Executable file
BIN
public/images/image_icon_153794.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Reference in New Issue
Block a user