本文整理汇总了PHP中ezcBaseFeatures::findExecutableInPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFeatures::findExecutableInPath方法的具体用法?PHP ezcBaseFeatures::findExecutableInPath怎么用?PHP ezcBaseFeatures::findExecutableInPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBaseFeatures
的用法示例。
在下文中一共展示了ezcBaseFeatures::findExecutableInPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkImageMagickComposite
private function checkImageMagickComposite()
{
if (!isset($settings->options['binary_composite'])) {
$this->binary_composite = ezcBaseFeatures::findExecutableInPath('composite');
} else {
if (file_exists($settings->options['binary_composite'])) {
$this->binary_composite = $settings->options['binary_composite'];
}
}
if ($this->binary_composite === null) {
throw new ezcImageHandlerNotAvailableException('ezcImageImagemagickHandler', 'ImageMagick not installed or not available in PATH variable.');
}
// Prepare to run ImageMagick command
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
// Open ImageMagick process
$imageProcess = proc_open($this->binary_composite, $descriptors, $pipes);
// Close STDIN pipe
fclose($pipes[0]);
$outputString = '';
// Read STDOUT
do {
$outputString .= rtrim(fgets($pipes[1], 1024), "\n");
} while (!feof($pipes[1]));
$errorString = '';
// Read STDERR
do {
$errorString .= rtrim(fgets($pipes[2], 1024), "\n");
} while (!feof($pipes[2]));
// Wait for process to terminate and store return value
$return = proc_close($imageProcess);
// Process potential errors
if (strlen($errorString) > 0 || strpos($outputString, 'ImageMagick') === false) {
throw new ezcImageHandlerNotAvailableException('ezcImageImagemagickHandler', 'ImageMagick not installed or not available in PATH variable.');
}
}
示例2: swfCompare
/**
* Compares to flash files comparing the output of `swftophp`
*
* @param string $generated Filename of generated image
* @param string $compare Filename of stored image
* @return void
*/
protected function swfCompare($generated, $compare)
{
$this->assertTrue(file_exists($generated), 'No image file has been created.');
$this->assertTrue(file_exists($compare), 'Comparision image does not exist.');
$executeable = ezcBaseFeatures::findExecutableInPath('swftophp');
if (!$executeable) {
$this->markTestSkipped('Could not find swftophp executeable to compare flash files. Please check your $PATH.');
}
$this->assertEquals($this->normalizeFlashCode(shell_exec($executeable . ' ' . escapeshellarg($compare))), $this->normalizeFlashCode(shell_exec($executeable . ' ' . escapeshellarg($generated))), 'Rendered image is not correct.');
}
示例3: swfCompare
/**
* Compares to flash files comparing the output of `swftophp`
*
* @param string $generated Filename of generated image
* @param string $compare Filename of stored image
* @return void
*/
protected function swfCompare($generated, $compare)
{
$this->assertTrue(file_exists($generated), 'No image file has been created.');
$this->assertTrue(file_exists($compare), 'Comparision image does not exist.');
$executeable = ezcBaseFeatures::findExecutableInPath('swftophp');
if (!$executeable) {
$this->markTestSkipped('Could not find swftophp executeable to compare flash files. Please check your $PATH.');
}
$generatedCode = shell_exec($executeable . ' ' . escapeshellarg($generated));
$compareCode = shell_exec($executeable . ' ' . escapeshellarg($compare));
foreach (array('generatedCode' => $generatedCode, 'compareCode' => $compareCode) as $var => $content) {
$content = preg_replace('/\\$[sf]\\d+/', '$var', $content);
$content = preg_replace('[/\\*.*\\*/]i', '/* Comment irrelevant */', $content);
${$var} = $content;
}
$this->assertEquals($generatedCode, $compareCode, 'Rendered image is not correct.');
}