Browse Source

Fixes

master
M@d D3n 4 years ago
parent
commit
75f7031ca0
  1. 4
      admin/templates/css/color_default.css
  2. 15
      inc/config.php
  3. 23
      inc/thumb.php

4
admin/templates/css/color_default.css

@ -286,8 +286,8 @@ ul.sub li a.numberRight:hover {
.head {
background:#373840;
height:32px;
border-top:1px solid #373840;
border-bottom:1px solid #373840;
border-top:none;
border-bottom:none;
position:relative;
color:#fff;
border-top:none;

15
inc/config.php

@ -212,6 +212,13 @@
'VARIANT' => ''
];
//-- Качество сжатие JPG миниатюр
$GLOBALS['CMS_CONFIG']['_CONST_THUMBS']['JPG_QUALITY'] = [
'DESCR' => 'Качество сжатие JPG миниатюр',
'DEFAULT' => 90,
'TYPE' => 'integer',
'VARIANT' => ''
];
//-- Создавать progressive JPG
$GLOBALS['CMS_CONFIG']['_CONST_THUMBS']['JPG_PROGRESSIVE'] = [
@ -229,6 +236,14 @@
'VARIANT' => ''
];
//-- Отдавать браузеру, что нужно кешировать изображение (60*60*24*14 - 2 недели)
$GLOBALS['CMS_CONFIG']['_CONST_THUMBS']['THUMBNAIL_CACHE_LIFETIME'] = [
'DESCR' => 'Отдавать браузеру, что нужно кешировать изображение (60*60*24*14 - 2 недели)',
'DEFAULT' => 60*60*24*14,
'TYPE' => 'integer',
'VARIANT' => ''
];
/* ======================================================================================================== */
//-- Директория для хранения оригиналов изображений (watermark)

23
inc/thumb.php

@ -46,6 +46,8 @@
* @param integer $mode Optional permissions
* @return boolean Success
*/
if (! function_exists('_mkdir'))
{
function _mkdir ($path, $mode = 0777)
{
$old = umask(0);
@ -54,6 +56,7 @@
return $res;
}
}
/**
* Creates directories recursively
@ -62,10 +65,13 @@
* @param integer $mode Optional permissions
* @return boolean Success
*/
if (! function_exists('rmkdir'))
{
function rmkdir ($path, $mode = 0777)
{
return is_dir($path) || (mkdir(dirname($path), $mode) && _mkdir($path, $mode));
}
}
if (filesize(BASE_DIR . '/config/config.inc.php'))
require_once BASE_DIR . '/config/config.inc.php';
@ -73,7 +79,16 @@
require_once BASE_DIR . '/inc/config.php';
//-- Разрешенные расширения файлов
$allowedExt = ['jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF'];
$allowedExt = [
'jpg',
'jpeg',
'png',
'gif',
'JPG',
'JPEG',
'PNG',
'GIF'
];
//-- Разрешенные размеры миниатюр
$allowedSize = (defined('THUMBNAIL_SIZES') && THUMBNAIL_SIZES != '')
@ -124,9 +139,11 @@
{
$img_data = @getimagesize($baseDir . $imagefile);
header('max-age=315360000, public', true);
header('Content-Type:' . $img_data['mime'], true);
header("Last-Modified: " . gmdate("D, d M Y H:i:s" . filemtime($baseDir . $imagefile)) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + THUMBNAIL_CACHE_LIFETIME) . " GMT");
header("Content-Length: " . (string) filesize($baseDir . $imagefile), true);
readfile($baseDir . $imagefile);
exit;
@ -244,6 +261,8 @@
$save = false;
}
define('IMAGE_TOOLBOX_DEFAULT_JPEG_QUALITY', JPG_QUALITY);
require $baseDir . '/class/class.thumbnail.php';
$thumb = new Image_Toolbox("$imagePath/$imageName");

Loading…
Cancel
Save