本文整理汇总了PHP中ezcBaseFeatures::getImageConvertExecutable方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFeatures::getImageConvertExecutable方法的具体用法?PHP ezcBaseFeatures::getImageConvertExecutable怎么用?PHP ezcBaseFeatures::getImageConvertExecutable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBaseFeatures
的用法示例。
在下文中一共展示了ezcBaseFeatures::getImageConvertExecutable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInitFromSetBinary
public function testInitFromSetBinary()
{
$settings = ezcImageImagemagickHandler::defaultSettings();
$settings->options['binary'] = ezcBaseFeatures::getImageConvertExecutable();
$handler = new ezcImageImagemagickHandler($settings);
$filePath = $this->testFiles["jpeg"];
$ref = $handler->load($filePath);
$handler->close($ref);
}
示例2: testGetImageConvertExecutable
public function testGetImageConvertExecutable()
{
$this->assertEquals('/usr/bin/convert', ezcBaseFeatures::getImageConvertExecutable());
}
示例3: testGetImageConvertExecutable
public function testGetImageConvertExecutable()
{
$this->assertNotNull(ezcBaseFeatures::getImageConvertExecutable());
}
示例4: checkImageMagick
/**
* Checks for ImageMagick on the system.
*
* @param ezcImageHandlerSettings $settings The settings object of the current handler instance.
* @return void
*
* @throws ezcImageHandlerNotAvailableException
* If the ImageMagick binary is not found.
*/
private function checkImageMagick(ezcImageHandlerSettings $settings)
{
if (!isset($settings->options['binary'])) {
$this->binary = ezcBaseFeatures::getImageConvertExecutable();
} else {
if (file_exists($settings->options['binary'])) {
$this->binary = $this->settings['binary'];
}
}
if ($this->binary === 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, $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.');
}
}