kezdetleges képkorrekció beépítve
This commit is contained in:
parent
87463e3a90
commit
626821ed9a
13
index.php
13
index.php
@ -50,7 +50,7 @@
|
||||
</section>
|
||||
</section>
|
||||
<section class="upload-popup-inner-container" id="infoform">
|
||||
<section style="margin: 3em 0em;">
|
||||
<section style="margin: 0em 0em;">
|
||||
<label for="author">Alkotó:*</label><br>
|
||||
<input type="text" id="author" style="width: 440px;" placeholder="Arthur Dent"><br><br>
|
||||
<label for="imgtitle">Cím:*</label><br>
|
||||
@ -58,7 +58,16 @@
|
||||
<label for="description">Leírás:</label><br>
|
||||
<textarea id="description" style="width: 440px; height: 5em;"
|
||||
placeholder="A válasz az életet, a világmindenséget, meg mindent érintő kérdésre."></textarea><br><br>
|
||||
<input type="checkbox" id="respchkbox">A feltöltött tartalmamért <i>teljes</i> felelősséget vállalok.
|
||||
<input type="checkbox" id="autocorrchkbox">Kérek automatikus képkorrekciót! (expozíció, élesítés)<br><br>
|
||||
<input type="checkbox" id="respchkbox">A feltöltött tartalmamért <i>teljes</i> felelősséget vállalok.<br><br>
|
||||
</section>
|
||||
<section style="text-align: right;">
|
||||
<section class="btn" onclick="publish()" id="publishbtn">Mehet!</section>
|
||||
</section>
|
||||
</section>
|
||||
<section class="upload-popup-inner-container" id="imgcorrection">
|
||||
<section style="margin: 3em 0em;">
|
||||
|
||||
</section>
|
||||
<section style="text-align: right;">
|
||||
<section class="btn" onclick="publish()" id="publishbtn">Mehet!</section>
|
||||
|
@ -123,14 +123,24 @@ function publish_image($artwork_details)
|
||||
// nagyméretű kép elkészítése
|
||||
$large_filename = PUBLISHED_DIR . DIRECTORY_SEPARATOR . $final_filename;
|
||||
|
||||
// korrekciós parancs
|
||||
$autocorrect = $artwork_details["autocorrect"];
|
||||
$img_autocorrect = $autocorrect ? "-normalize -sharpen 5" : "";
|
||||
|
||||
// ha a fájl nagyobb, mint 2MB, akkor visszatömörítjük
|
||||
$filesize = filesize($incoming_filename);
|
||||
if ($filesize > $MAX_LARGE_IMAGE_FILESIZE) {
|
||||
$cmd = "convert -define jpeg:extent=$MAX_LARGE_IMAGE_FILESIZE_STR $incoming_filename $large_filename";
|
||||
$cmd = "convert -define jpeg:extent=$MAX_LARGE_IMAGE_FILESIZE_STR $img_autocorrect $incoming_filename $large_filename";
|
||||
shell_exec($cmd);
|
||||
unlink($incoming_filename); // törlés az incoming-ból
|
||||
} else { //...ha nem volt túl nagy a fájl
|
||||
shell_exec("mv $incoming_filename $large_filename");
|
||||
if ($autocorrect) {
|
||||
$cmd = "convert $img_autocorrect $incoming_filename $large_filename";
|
||||
shell_exec($cmd);
|
||||
unlink($incoming_filename); // törlés az incoming-ból
|
||||
} else {
|
||||
shell_exec("mv $incoming_filename $large_filename");
|
||||
}
|
||||
}
|
||||
|
||||
// bélyegkép elkészítése
|
||||
|
@ -41,6 +41,7 @@ function pup_reset() {
|
||||
reset_slider(slider_id); // slider visszaállítása
|
||||
o(publish_btn_id).innerText = "Mehet!"; // gombfelirat visszaállítása
|
||||
o("respchkbox").checked = false; // pipa kivétele
|
||||
o("autocorrchkbox").checked = false;
|
||||
|
||||
// mezők törlése
|
||||
o("author").value = "";
|
||||
@ -58,6 +59,7 @@ function publish() {
|
||||
let author = o("author").value;
|
||||
let title = o("imgtitle").value;
|
||||
let desc = o("description").value;
|
||||
let autocorr = o("autocorrchkbox").checked;
|
||||
|
||||
// ha a kötelező mezők nincsenek kitöltve, akkor nem lehet beküldeni
|
||||
if (author.trim() === "" || title.trim() === "") {
|
||||
@ -75,7 +77,8 @@ function publish() {
|
||||
uid: image_uid,
|
||||
author: author,
|
||||
title: title,
|
||||
desc: desc
|
||||
desc: desc,
|
||||
autocorrect: autocorr
|
||||
}
|
||||
|
||||
// küldés
|
||||
@ -87,11 +90,10 @@ function publish() {
|
||||
|
||||
req.onreadystatechange = state => {
|
||||
if (req.status === 200 && req.readyState === 4) {
|
||||
pup_reset(); // popup resetelése
|
||||
close_upload_pup(); // popup resetelése
|
||||
|
||||
if (Number(req.response) === 0) {
|
||||
alert("Sikeres feltöltés!");
|
||||
close_upload_pup();
|
||||
} else if (Number(req.response) === -1) {
|
||||
alert("Ugyanezt képet már korábban feltöltötték!");
|
||||
} else {
|
||||
@ -585,6 +587,7 @@ function init_viewer() {
|
||||
viewer_original_offset_coords = img.offset;
|
||||
viewer_original_mouse_coords = { x: t[0].screenX, y: t[0].screenY };
|
||||
viewer_grabbing = true;
|
||||
last_touch_distance = 0;
|
||||
}, false);
|
||||
|
||||
img.addEventListener("touchmove", (e) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user