mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-14 19:19:08 +03:00
some fixes
This commit is contained in:
parent
beaf493cb6
commit
12de4999a9
3 changed files with 14 additions and 4 deletions
|
@ -14,7 +14,6 @@ class Compress {
|
|||
$height = $info[1];
|
||||
$aspect_ratio = $width / $height;
|
||||
|
||||
// Вычисляем новые размеры, сохраняя соотношение сторон
|
||||
if ($width > $height) {
|
||||
$new_width = $max_width;
|
||||
$new_height = $max_width / $aspect_ratio;
|
||||
|
@ -64,10 +63,22 @@ class Compress {
|
|||
$quality = 40;
|
||||
$max_width = 400;
|
||||
$max_height = 400;
|
||||
|
||||
if (!file_exists($_SERVER['DOCUMENT_ROOT'].'/cdn/imgcache')) {
|
||||
mkdir($_SERVER['DOCUMENT_ROOT'].'/cdn/imgcache', 0777, true);
|
||||
}
|
||||
|
||||
$parsed_url = parse_url($source_url);
|
||||
if (!isset($parsed_url['scheme'])) {
|
||||
$local_file_path = $_SERVER['DOCUMENT_ROOT'] . '/' . ltrim($source_url, '/');
|
||||
if (file_exists($local_file_path)) {
|
||||
$source_url = $local_file_path;
|
||||
} else {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$cache_filename = self::generateCacheFilename($source_url, $quality, $max_width, $max_height);
|
||||
|
||||
if (file_exists($cache_filename)) {
|
||||
|
@ -78,7 +89,7 @@ class Compress {
|
|||
if ($compressed_image_data) {
|
||||
file_put_contents($cache_filename, $compressed_image_data);
|
||||
} else {
|
||||
$imageData = file_get_contents($_GET['url']);
|
||||
$imageData = file_get_contents($source_url);
|
||||
|
||||
$finfo = new \finfo(FILEINFO_MIME_TYPE);
|
||||
$mimeType = $finfo->buffer($imageData);
|
||||
|
|
|
@ -46,7 +46,6 @@ class Upload
|
|||
if (filesize($_SERVER['DOCUMENT_ROOT'].'/'.$location.$filecdn) >= 94371840) {
|
||||
mkdir("{$_SERVER['DOCUMENT_ROOT']}/uploads/{$location}", 0777, true);
|
||||
move_uploaded_file ($tmpname, "{$_SERVER['DOCUMENT_ROOT']}/uploads/{$folder}");
|
||||
|
||||
$this->type = $type;
|
||||
$this->src = "/uploads/{$folder}";
|
||||
$this->size = self::human_filesize(filesize($tmpname));
|
||||
|
|
|
@ -9,7 +9,7 @@ function createModal(id, type, value, modalid) {
|
|||
<textarea style=" width: 100%;
|
||||
height: 200px;" name="wtext" id="bodypost__commedit`+id+`">`+value+`</textarea><br>
|
||||
<div class="cmt-submit">
|
||||
<button type="submit" onclick="editComment('` + id + `', document.getElementById('bodypost__commedit` + id + `').value, , '`+modalid+`')" id="sbmt">Отредактировать</button>  Ctrl + Enter
|
||||
<button type="submit" onclick="editComment('` + id + `', document.getElementById('bodypost__commedit` + id + `').value, '`+modalid+`')" id="sbmt">Отредактировать</button>  Ctrl + Enter
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue