From a13cdb85e3f79c3f3c51a3b566a09c17500aaa67 Mon Sep 17 00:00:00 2001 From: profiteroles Date: Wed, 6 Nov 2019 10:54:26 -0800 Subject: [PATCH] 0.9.0.1 --- CHANGELOG.md | 4 ++++ current_version.txt | 2 +- leaf.php | 16 +++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb534b..02d35a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +[0.9.0.1] + +- Better tmp dir + [0.9.0.0] - Added output levels option \ No newline at end of file diff --git a/current_version.txt b/current_version.txt index ef3d8e2..e608a6e 100644 --- a/current_version.txt +++ b/current_version.txt @@ -1 +1 @@ -0.9.0.0 \ No newline at end of file +0.9.0.1 \ No newline at end of file diff --git a/leaf.php b/leaf.php index d2d1484..302eec0 100644 --- a/leaf.php +++ b/leaf.php @@ -3,9 +3,11 @@ // Leaf - Tools for Book Scans // No license, do not distribute -$version = "0.9.0.0"; +$version = "0.9.0.1"; $time_start = microtime(true); date_default_timezone_set("America/Los_Angeles"); +$tmpdir = "/tmp/".time(); +mkdir($tmpdir); // Detect cores @@ -1049,12 +1051,12 @@ foreach ($files as $file) { $ext = pathinfo($file,PATHINFO_EXTENSION); $output = $dest."/".basename($file,$ext)."jpg"; $msg = "Creating hough composite from ".$file; - $cmd = "convert ".$file."[".$size."x".$size."] -auto-orient \( +clone -canny ".$canny." -write /tmp/".basename($file)."_canny.png "; - $cmd .= "-background none -fill red -stroke red -strokewidth 1 -hough-lines ".$hough." -write /tmp/".basename($file)."_lines.png \) "; + $cmd = "convert ".$file."[".$size."x".$size."] -auto-orient \( +clone -canny ".$canny." -write ".$tmpdir.basename($file)."_canny.png "; + $cmd .= "-background none -fill red -stroke red -strokewidth 1 -hough-lines ".$hough." -write ".$tmpdir.basename($file)."_lines.png \) "; $cmd .= "-composite ".$output; $thread[] = array($msg, $cmd); $msg = "Creating MVG file from ".$file; - $cmd = "convert /tmp/".basename($file)."_canny.png -hough-lines ".$hough." ".$output.".mvg"; + $cmd = "convert ".$tmpdir.basename($file)."_canny.png -hough-lines ".$hough." ".$output.".mvg"; $thread[] = array($msg, $cmd); } @@ -1216,10 +1218,10 @@ if (ask("Create spreads? (Y/n)") != "n") { $left = $ops[($key*2)]; $right = $ops[($key*2)+1]; $ext = pathinfo($left[0],PATHINFO_EXTENSION); $lfile = $left[0]; $rfile = $right[0]; - $tmpleft = "/tmp/".basename($left[1]); $tmpright = "/tmp/".basename($right[1]); + $tmpleft = $tmpdir.basename($left[1]); $tmpright = $tmpdir.basename($right[1]); if ($ext == "DNG" && getjpg($left[0]) && getjpg($right[0])) { $lfile = getjpg($left[0]); $rfile = getjpg($right[0]); - $tmpleft = "/tmp/".basename($left[1],$ext)."JPG"; $tmpright = "/tmp/".basename($right[1],$ext)."JPG"; + $tmpleft = $tmpdir.basename($left[1],$ext)."JPG"; $tmpright = $tmpdir.basename($right[1],$ext)."JPG"; } elseif ($ext == "DNG") { echo "-"; continue; @@ -1227,7 +1229,7 @@ if (ask("Create spreads? (Y/n)") != "n") { copy($lfile,$tmpleft); copy($rfile,$tmpright); exec("exiftool -overwrite_original -n -Orientation=".$left[2]." ".$tmpleft."; exiftool -overwrite_original -n -Orientation=".$right[2]." ".$tmpright."; "); exec("montage -label '%f' -font Helvetica -pointsize 20 -background '#000000' -fill 'white' -define jpeg:size=1000x1000 -geometry 1000x1000+2+2 -auto-orient ".$tmpleft." ".$tmpright." /tmp/contact_sheet_".$key.".jpg"); - $sheets[] = "/tmp/contact_sheet_".$key.".jpg"; + $sheets[] = $tmpdir."contact_sheet_".$key.".jpg"; echo "."; } echo "\n\n";