|
@@ -232,7 +232,7 @@ class LA{
|
|
|
}
|
|
|
fwrite($conf, 'RewriteCond %{HTTPS} !=on'.PHP_EOL.
|
|
|
'RewriteCond %{HTTP_HOST} !=localhost'.PHP_EOL.
|
|
|
- 'RewriteCond %{REQUEST_URI} !^.*(jpg|png|gif)$'.PHP_EOL.
|
|
|
+ 'RewriteCond %{REQUEST_URI} !^.*(jpg|jpeg|png|gif)$'.PHP_EOL.
|
|
|
'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC]'.PHP_EOL.PHP_EOL);
|
|
|
fwrite($conf,'<Files ~ "\.md$">'.PHP_EOL.'deny from all'.PHP_EOL.'</Files>'.PHP_EOL);
|
|
|
fflush($conf);fclose($conf);
|
|
@@ -1297,7 +1297,7 @@ blockquote{border-left:2px solid black;}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function CompressImage($source, $destination, $thumb_destination, $quality, $sizelim, $abs_max, $ext) {
|
|
|
+ function CompressImage($source, $destination, $thumb_destination, $quality, $sizelim, $abs_max, $ext, $transparency) {
|
|
|
$img = new Imagick($source); $geo=$img->getImageGeometry(); $img2 = clone $img;
|
|
|
$width=$geo['width']; $height=$geo['height'];
|
|
|
$lim=400;
|
|
@@ -1305,17 +1305,25 @@ blockquote{border-left:2px solid black;}
|
|
|
if($scale<1){
|
|
|
$img->resizeImage($width*$scale,$height*$scale,imagick::FILTER_GAUSSIAN,0.7);
|
|
|
}
|
|
|
- $img->setImageFormat('jpeg');
|
|
|
- $img->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
|
|
- $img->setImageCompressionQuality($quality);
|
|
|
+ if(!$transparency){
|
|
|
+ $img->setImageBackgroundColor(new ImagickPixel('gray'));
|
|
|
+ $img=$img->flattenImages();
|
|
|
+ $img->setImageFormat('jpeg');
|
|
|
+ $img->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
|
|
+ $img->setImageCompressionQuality($quality);
|
|
|
+ }
|
|
|
$img->writeImage($thumb_destination);
|
|
|
|
|
|
$scale = min( $sizelim / min($width,$height), $abs_max / max($width,$height));
|
|
|
if($scale<0.98 || ($ext!='jpg'&&$ext!='jpeg')){
|
|
|
$img2->resizeImage($width*$scale,$height*$scale,imagick::FILTER_GAUSSIAN,0.5);
|
|
|
- $img2->setImageFormat('jpeg');
|
|
|
- $img2->setImageCompressionQuality($quality);
|
|
|
- $img2->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
|
|
+ if(!$transparency){
|
|
|
+ $img2->setImageFormat('jpeg');
|
|
|
+ $img2->setImageBackgroundColor(new ImagickPixel('gray'));
|
|
|
+ $img2=$img2->flattenImages();
|
|
|
+ $img2->setImageCompressionQuality($quality);
|
|
|
+ $img2->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
|
|
+ }
|
|
|
$img2->writeImage($destination);
|
|
|
}else{
|
|
|
rename($source,$destination);
|
|
@@ -1339,9 +1347,10 @@ blockquote{border-left:2px solid black;}
|
|
|
if(isset($_POST['image_replace_button']) && isset($_GET['pic']) && preg_match('/([0-9]{14,})/u',$_GET['pic'],$mim)){
|
|
|
$num = $mim[1]; $replace=1;
|
|
|
}
|
|
|
+ $transparency = (isset($_GET['transparency'])&&$_GET['transparency']);
|
|
|
$base = 'images/'.$num;
|
|
|
$thumb = 'images/thumb/'.$num;
|
|
|
- $use_ext=($ext=='gif' || $ext=='mp4')?('.'.$ext):('.jpg');
|
|
|
+ $use_ext=($ext=='gif' || $ext=='mp4' || $transparency)?('.'.$ext):('.jpg');
|
|
|
$final_path = $base.$use_ext; $final_thumb = $thumb.$use_ext; $i=0;
|
|
|
if(!$replace) while(file_exists($final_path)){
|
|
|
$final_path = $base.strval($i).$use_ext; $final_thumb = $thumb.strval($i).$use_ext; $i++;
|
|
@@ -1349,7 +1358,7 @@ blockquote{border-left:2px solid black;}
|
|
|
if($ext!='gif' && $ext!='mp4'){
|
|
|
$compress = (isset($_GET['compress'])&&$_GET['compress']);
|
|
|
$this->CompressImage($_FILES['upload_file_name']['tmp_name'], $final_path, $final_thumb, 90,
|
|
|
- $compress?800:1920, $compress?1920:2560, $ext);
|
|
|
+ $compress?800:1920, $compress?1920:2560, $ext, $transparency);
|
|
|
}else{
|
|
|
move_uploaded_file($_FILES['upload_file_name']['tmp_name'], $final_path);
|
|
|
}
|
|
@@ -3454,7 +3463,7 @@ blockquote{border-left:2px solid black;}
|
|
|
$make_title = ($p == $post);
|
|
|
if(isset($p['restart'])){ $STR="<li class='restart'><h3>{$p['restart']} …</h3></li>"; $this->TFill(0,$STR,3); $this->TExtra("class='no_line'"); $this->TRow(); }
|
|
|
$this->MakeSinglePostV2($p,true,false,$use_class,false, false, false, true, false, false);
|
|
|
- if($make_title){ $STR.='<script>
|
|
|
+ if($make_title){ $STR='<script>
|
|
|
document.title+=" | '.addslashes(preg_replace('/\r|\n/u', ' ', mb_substr($this->GetPostTitle($p),0,100))).'"</script>';
|
|
|
$this->TFill(2,$STR); $this->TExtra("class='no_line'");
|
|
|
}
|
|
@@ -4469,8 +4478,19 @@ blockquote{border-left:2px solid black;}
|
|
|
for(i=0;i<_fd_list.length;i++){
|
|
|
if (_fd_list[i][0] == num){
|
|
|
state = _fd_list[i][2];
|
|
|
- if(state){_fd_list[i][2] = 0; button.innerHTML='1920';break;}
|
|
|
- else{_fd_list[i][2] = 1; button.innerHTML='800';break;}
|
|
|
+ if(state){_fd_list[i][2] = 0; button.innerHTML='L';break;}
|
|
|
+ else{_fd_list[i][2] = 1; button.innerHTML='S';break;}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function ToggleTransparency(button){
|
|
|
+ li = button.parentNode;
|
|
|
+ num=li.dataset.number;
|
|
|
+ for(i=0;i<_fd_list.length;i++){
|
|
|
+ if (_fd_list[i][0] == num){
|
|
|
+ state = _fd_list[i][4];
|
|
|
+ if(state){_fd_list[i][4] = 0; button.innerHTML='●';break;}
|
|
|
+ else{_fd_list[i][4] = 1; button.innerHTML='○';break;}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4522,7 +4542,7 @@ blockquote{border-left:2px solid black;}
|
|
|
for(i=0;i<_fd_list.length;i++){
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
var li = list.querySelector('[data-number="'+_fd_list[i][0].toString()+'"]')
|
|
|
- xhr.open("POST", "?compress="+_fd_list[i][2].toString(), true);
|
|
|
+ xhr.open("POST", "?compress="+_fd_list[i][2].toString()+"&transparency="+_fd_list[i][4].toString(), true);
|
|
|
function wrap(li, i){
|
|
|
var ind = li.querySelector('._compress_toggle')
|
|
|
return function(){
|
|
@@ -4556,14 +4576,15 @@ blockquote{border-left:2px solid black;}
|
|
|
var fd = new FormData();
|
|
|
blob.name = blob.name=generateUID().toString();
|
|
|
fd.append("upload_file_name", blob, "_upload_"+blob.name+"."+ext);
|
|
|
- _fd_list.push([blob.name, fd, 1, 0]);/* number original is_compress uploaded */
|
|
|
+ _fd_list.push([blob.name, fd, 1, 0, 0]);/* number original is_compress uploaded transparency */
|
|
|
var reader = new FileReader();
|
|
|
reader.onload = function(event){
|
|
|
fl = document.querySelector("#file_list");
|
|
|
ht = "<li id='_upload_"+blob.name+"' data-number='"+blob.name+"'>"+
|
|
|
"<a class='_remove_file pointer invert_a' onclick='RemoveFromUpload(this)'>×</a> "+"<div class='file_thumb'>"+
|
|
|
"<img class='no_pop' src='"+event.target.result+"'>"+"</div>"+
|
|
|
- " →<a class='_compress_toggle pointer' onclick='ToggleCompress(this)'>800</a></li>";
|
|
|
+ " →<a class='_compress_toggle pointer' onclick='ToggleCompress(this)'>S</a>"+
|
|
|
+ " <a class='_transparency_toggle pointer' onclick='ToggleTransparency(this)'>●</a></li>";
|
|
|
fl.innerHTML+=ht;
|
|
|
};
|
|
|
reader.readAsDataURL(blob);
|