本文整理汇总了PHP中system::find_binary方法的典型用法代码示例。如果您正苦于以下问题:PHP system::find_binary方法的具体用法?PHP system::find_binary怎么用?PHP system::find_binary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类system
的用法示例。
在下文中一共展示了system::find_binary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find_gs
/**
* Return the path to the gs binary if one exists and is executable, or null.
* (ref: movie::find_ffmpeg())
*/
static function find_gs()
{
if (!($gs_path = module::get_var("pdf", "gs_path")) || !@is_executable($gs_path)) {
$gs_path = system::find_binary("gs", module::get_var("gallery", "graphics_toolkit_path"));
module::set_var("pdf", "gs_path", $gs_path);
}
return $gs_path;
}
示例2: find_ffmpeg
/**
* Return the path to the ffmpeg binary if one exists and is executable, or null.
*/
static function find_ffmpeg()
{
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
$ffmpeg_path = system::find_binary("ffmpeg", module::get_var("gallery", "graphics_toolkit_path"));
module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
}
return $ffmpeg_path;
}
示例3: detect_dcraw
static function detect_dcraw()
{
$dcraw = new stdClass();
$path = system::find_binary("dcraw");
if (empty($path)) {
$dcraw->installed = false;
$dcraw->error = t("The <em>dcraw</em> tool could not be located on your system.");
} 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.");
} 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.");
} else {
$dcraw->version = $matches[1];
$dcraw->installed = true;
}
}
}
return $dcraw;
}
示例4: detect_toolkits
/**
* Detect which graphics toolkits are available on this system. Return an array of key value
* pairs where the key is one of gd, imagemagick, graphicsmagick and the value is information
* about that toolkit. For GD we return the version string, and for ImageMagick and
* GraphicsMagick we return the path to the directory containing the appropriate binaries.
*/
static function detect_toolkits()
{
$toolkits = new stdClass();
$toolkits->gd = new stdClass();
$toolkits->imagemagick = new stdClass();
$toolkits->graphicsmagick = new stdClass();
// GD is special, it doesn't use exec()
$gd = function_exists("gd_info") ? gd_info() : array();
$toolkits->gd->name = "GD";
if (!isset($gd["GD Version"])) {
$toolkits->gd->installed = false;
$toolkits->gd->error = t("GD is not installed");
} else {
$toolkits->gd->installed = true;
$toolkits->gd->version = $gd["GD Version"];
$toolkits->gd->rotate = function_exists("imagerotate");
$toolkits->gd->sharpen = function_exists("imageconvolution");
$toolkits->gd->binary = "";
$toolkits->gd->dir = "";
if (!$toolkits->gd->rotate && !$toolkits->gd->sharpen) {
$toolkits->gd->error = t("You have GD version %version, but it lacks image rotation and sharpening.", array("version" => $gd["GD Version"]));
} else {
if (!$toolkits->gd->rotate) {
$toolkits->gd->error = t("You have GD version %version, but it lacks image rotation.", array("version" => $gd["GD Version"]));
} else {
if (!$toolkits->gd->sharpen) {
$toolkits->gd->error = t("You have GD version %version, but it lacks image sharpening.", array("version" => $gd["GD Version"]));
}
}
}
}
if (!function_exists("exec")) {
$toolkits->imagemagick->installed = false;
$toolkits->imagemagick->error = t("ImageMagick requires the <b>exec</b> function");
$toolkits->graphicsmagick->installed = false;
$toolkits->graphicsmagick->error = t("GraphicsMagick requires the <b>exec</b> function");
} else {
// ImageMagick & GraphicsMagick
$magick_kits = array("imagemagick" => array("name" => "ImageMagick", "binary" => "convert", "version_arg" => "-v", "version_regex" => "/Version: \\S+ (\\S+)/"), "graphicsmagick" => array("name" => "GraphicsMagick", "binary" => "gm", "version_arg" => "version", "version_regex" => "/\\S+ (\\S+)/"));
// Loop through the kits
foreach ($magick_kits as $index => $settings) {
$path = system::find_binary($settings["binary"], module::get_var("gallery", "graphics_toolkit_path"));
$toolkits->{$index}->name = $settings["name"];
if ($path) {
if (@is_file($path) && preg_match($settings["version_regex"], shell_exec($path . " " . $settings["version_arg"]), $matches)) {
$version = $matches[1];
$toolkits->{$index}->installed = true;
$toolkits->{$index}->version = $version;
$toolkits->{$index}->binary = $path;
$toolkits->{$index}->dir = dirname($path);
$toolkits->{$index}->rotate = true;
$toolkits->{$index}->sharpen = true;
} else {
$toolkits->{$index}->installed = false;
$toolkits->{$index}->error = t("%toolkit_name is installed, but PHP's open_basedir restriction prevents Gallery from using it.", array("toolkit_name" => $settings["name"]));
}
} else {
$toolkits->{$index}->installed = false;
$toolkits->{$index}->error = t("We could not locate %toolkit_name on your system.", array("toolkit_name" => $settings["name"]));
}
}
}
return $toolkits;
}