Selectively omit dcraw options that would not be supported by the currently installed version.
This commit is contained in:
parent
bb9715a293
commit
8ad55995ae
@ -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)) {
|
||||
if (!empty($post->$field)) {
|
||||
if (!@is_file($post->$field)) {
|
||||
$post->add_error($field, t("No ICC profile exists at the location <code>%icc_path</code>",
|
||||
array("icc_path" => $post->$field)));
|
||||
}
|
||||
$dcraw = rawphoto_graphics::detect_dcraw();
|
||||
if (version_compare($dcraw->version, "8.00", "<")) {
|
||||
$post->add_error($field, t("Versions of <em>dcraw</em> before <code>8.00</code> do not support an ICC profile"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,18 +24,22 @@ class rawphoto_graphics {
|
||||
if (empty($path)) {
|
||||
$dcraw->installed = false;
|
||||
$dcraw->error = t("The <em>dcraw</em> tool could not be located on your system.");
|
||||
} else if (!@is_file($path)) {
|
||||
} else {
|
||||
$dcraw->path = $path;
|
||||
if (!@is_file($path)) {
|
||||
$dcraw->installed = false;
|
||||
$dcraw->error = t("The <em>dcraw</em> tool is installed, but PHP's " .
|
||||
"<code>open_basedir</code> restriction prevents Gallery from using it.");
|
||||
$dcraw->error = t("The <em>dcraw</em> tool is installed, " .
|
||||
"but PHP's <code>open_basedir</code> 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 <em>dcraw</em> tool is installed, but the version is not recognized.");
|
||||
$dcraw->error = t("The <em>dcraw</em> tool is installed, " .
|
||||
"but the version is not recognized.");
|
||||
} else {
|
||||
$dcraw->installed = true;
|
||||
$dcraw->path = $path;
|
||||
$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);
|
||||
|
@ -19,8 +19,9 @@
|
||||
<fieldset>
|
||||
<legend><?= t("Paths") ?></legend>
|
||||
<? if ($dcraw->installed): ?>
|
||||
<p><?= t("The <em>dcraw</em> tool was detected at <code>%path</code>.",
|
||||
array("path" => $dcraw->path)) ?></p>
|
||||
<p><?= t("The <em>dcraw</em> tool was detected at <code>%path</code> " .
|
||||
"with version <code>%version</code>.",
|
||||
array("path" => $dcraw->path, "version" => $dcraw->version)) ?></p>
|
||||
<? else: ?>
|
||||
<p class="g-module-status g-error g-block"><?= $dcraw->error ?></p>
|
||||
<? endif; ?>
|
||||
|
Reference in New Issue
Block a user