diff --git a/3.0/modules/rawphoto/controllers/admin_rawphoto.php b/3.0/modules/rawphoto/controllers/admin_rawphoto.php
index d5a315bf..0cf169f9 100644
--- a/3.0/modules/rawphoto/controllers/admin_rawphoto.php
+++ b/3.0/modules/rawphoto/controllers/admin_rawphoto.php
@@ -60,9 +60,15 @@ class Admin_RawPhoto_Controller extends Admin_Controller {
}
public function _validate_icc_path(Validation $post, $field) {
- if (!empty($post->$field) && !@is_file($post->$field)) {
- $post->add_error($field, t("No ICC profile exists at the location %icc_path
",
- array("icc_path" => $post->$field)));
+ if (!empty($post->$field)) {
+ if (!@is_file($post->$field)) {
+ $post->add_error($field, t("No ICC profile exists at the location %icc_path
",
+ array("icc_path" => $post->$field)));
+ }
+ $dcraw = rawphoto_graphics::detect_dcraw();
+ if (version_compare($dcraw->version, "8.00", "<")) {
+ $post->add_error($field, t("Versions of dcraw before 8.00
do not support an ICC profile"));
+ }
}
}
}
diff --git a/3.0/modules/rawphoto/helpers/rawphoto_graphics.php b/3.0/modules/rawphoto/helpers/rawphoto_graphics.php
index 121856e5..4a8da2ae 100644
--- a/3.0/modules/rawphoto/helpers/rawphoto_graphics.php
+++ b/3.0/modules/rawphoto/helpers/rawphoto_graphics.php
@@ -24,18 +24,22 @@ class rawphoto_graphics {
if (empty($path)) {
$dcraw->installed = false;
$dcraw->error = t("The dcraw tool could not be located on your system.");
- } else if (!@is_file($path)) {
- $dcraw->installed = false;
- $dcraw->error = t("The dcraw tool is installed, but PHP's " .
- "open_basedir
restriction prevents Gallery from using it.");
- } else if (!preg_match('/^Raw [Pp]hoto [Dd]ecoder(?: "dcraw")? v(\S+)$/m',
- shell_exec(escapeshellcmd($path) . " 2>&1"), $matches)) {
- $dcraw->installed = false;
- $dcraw->error = t("The dcraw tool is installed, but the version is not recognized.");
} else {
- $dcraw->installed = true;
$dcraw->path = $path;
- $dcraw->version = $matches[1];
+ if (!@is_file($path)) {
+ $dcraw->installed = false;
+ $dcraw->error = t("The dcraw tool is installed, " .
+ "but PHP's open_basedir
restriction " .
+ "prevents Gallery from using it.");
+ } else if (!preg_match('/^Raw [Pp]hoto [Dd]ecoder(?: "dcraw")? v(\S+)$/m',
+ shell_exec(escapeshellcmd($path) . " 2>&1"), $matches)) {
+ $dcraw->installed = false;
+ $dcraw->error = t("The dcraw tool is installed, " .
+ "but the version is not recognized.");
+ } else {
+ $dcraw->version = $matches[1];
+ $dcraw->installed = true;
+ }
}
return $dcraw;
}
@@ -73,9 +77,15 @@ class rawphoto_graphics {
$dcraw = rawphoto_graphics::detect_dcraw();
if ($dcraw->installed) {
// Use dcraw to convert from a raw image to a standard pixmap.
- $cmd = escapeshellcmd($dcraw->path) . " -c -w -W -t 0 ";
+ $cmd = escapeshellcmd($dcraw->path) . " -c -w ";
+ if (version_compare($dcraw->version, "6.00", ">=")) {
+ $cmd .= "-t 0 ";
+ }
+ if (version_compare($dcraw->version, "8.81", ">=")) {
+ $cmd .= "-W ";
+ }
$icc_path = module::get_var("rawphoto", "icc_path");
- if (!empty($icc_path)) {
+ if (!empty($icc_path) && version_compare($dcraw->version, "8.00", ">=")) {
$cmd .= "-p " . escapeshellarg($icc_path) . " ";
}
$cmd .= escapeshellarg($input_file);
diff --git a/3.0/modules/rawphoto/views/admin_rawphoto.html.php b/3.0/modules/rawphoto/views/admin_rawphoto.html.php
index 86445d5d..93b92e0b 100644
--- a/3.0/modules/rawphoto/views/admin_rawphoto.html.php
+++ b/3.0/modules/rawphoto/views/admin_rawphoto.html.php
@@ -19,8 +19,9 @@