summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-05-09 12:35:54 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-05-09 12:35:54 -0400
commitfc6d01a54f2f8cf51c9be7f8fe5be611c7c2cf22 (patch)
tree4fb05358fbc702b7c874ff0ad6f00af2ab2efc92
parent1e9a0a4aef49d354b1fad99abcd2f30b9fd22d3a (diff)
downloadpo-fc6d01a54f2f8cf51c9be7f8fe5be611c7c2cf22.tar.gz
po-fc6d01a54f2f8cf51c9be7f8fe5be611c7c2cf22.tar.bz2
po-fc6d01a54f2f8cf51c9be7f8fe5be611c7c2cf22.zip
[fix] Respect non-sRGB profiles (and embedded profiles!) when printing.HEADmaster
-rw-r--r--CHANGES1
-rw-r--r--src/include/print.printer.php14
2 files changed, 11 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index f75e6cc..3fb5fa1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -47,6 +47,7 @@ v2.38 (Unreleased)
[fix] Use hash of various parameters for scaled image filenames
[fix] Get rid of support for magic_quotes_gpc; This means we now require PHP 5.4 or newer!
[fix] Fix printing on remote hosts with newer CUPS
+ [fix] Respect embedded (and non-sRGB) ICC profiles when printing
v2.37.1 (December 3, 2012)
diff --git a/src/include/print.printer.php b/src/include/print.printer.php
index d0cc885..b68a861 100644
--- a/src/include/print.printer.php
+++ b/src/include/print.printer.php
@@ -64,6 +64,7 @@ function photo_print_single($database, $single) {
global $use_gm;
global $sys_lp;
global $tmp_volume_path;
+ global $icc_profiles;
$retval = FALSE;
$output = "";
@@ -78,7 +79,7 @@ function photo_print_single($database, $single) {
if ($title == "")
$title = $strings['photo_no_title'] ." - $single[photo]";
- $query = "select f.path as original_path, v.original_image_name, f.x_res, f.y_res
+ $query = "select f.path as original_path, v.original_image_name, f.x_res, f.y_res, v.colorspace
from photo_version v, files f
where v.identifier = $version and v.identifier = f.version and (f.size = $single[size] or f.size = 0) order by f.size desc";
@@ -91,6 +92,7 @@ function photo_print_single($database, $single) {
$native_x = $photo_version_single['x_res'];
$native_y = $photo_version_single['y_res'];
$original_name = $photo_version_single['original_image_name'];
+ $colorspace = $photo_version_single['colorspace'];
if (($printer['target_x'] > $printer['target_y'] && $native_x < $native_y) ||
($printer['target_x'] < $printer['target_y'] && $native_x > $native_y)) {
@@ -100,7 +102,7 @@ function photo_print_single($database, $single) {
/* check for the source file's existence */
if (!is_file($file_name)) {
$output .= err_str($strings['errors_file_not_found'] ." : ". sprintf($strings['export_skipped'],emit_a(generate_link('photo', $single['photo']), $title)));
- return $output;
+ return $output . "<br>\n";
}
$output .= "<li>Printing $original_name - $single[photo]:$single[version]:$single[size] on $printer[queue_name] at $printer[target_x]x$printer[target_y]</li>\n";
@@ -150,12 +152,15 @@ function photo_print_single($database, $single) {
# sharpen as needed
$cmdline .= " -unsharp ". escapeshellarg("0x". $printer['sharpen_sigma'] ."+". $printer['sharpen_amount'] ."+". $printer['sharpen_threshold']) . " ";
- # Apply color correction ## XXX what about files with embedded profiles?
+ # Apply color correction
if (isset($printer['icc_profile']) &&
strlen($printer['icc_profile'])) {
$iccname = "im/" . $printer['icc_profile'];
if (is_file($iccname)) {
- $cmdline .= " +profile icm -profile " . escapeshellarg("im/sRGB.icm") . " -profile ". escapeshellarg($iccname) . " +profile icm ";
+ if ($colorspace != 99) {
+ $cmdline .= " +profile icm -profile " . escapeshellarg($icc_profiles[$colorspace]['file']);
+ }
+ $cmdline .= " -profile ". escapeshellarg($iccname) . " +profile icm ";
}
}
@@ -165,6 +170,7 @@ function photo_print_single($database, $single) {
# $output .= "<pre>$cmdline</pre>\n";
system($cmdline, $retval);
+
if ($retval) {
$output .= err_str("FAILED: >>><pre>$cmdline</pre><<< $retval\n");
return $output;