mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Add check on Video icon on video thumbnail
This commit is contained in:
@@ -24,7 +24,7 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $options = array(
|
protected $options = array(
|
||||||
'size' => null
|
'size' => null
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,7 +42,7 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb
|
|||||||
protected function process(system_file $origine, $dest)
|
protected function process(system_file $origine, $dest)
|
||||||
{
|
{
|
||||||
$tmpDir = $this->registry->get('GV_RootPath')
|
$tmpDir = $this->registry->get('GV_RootPath')
|
||||||
. 'tmp/' . 'tmp' . time() . '/';
|
. 'tmp/' . 'tmp' . time() . '/';
|
||||||
system_file::mkdir($tmpDir);
|
system_file::mkdir($tmpDir);
|
||||||
|
|
||||||
$tmpFile = $tmpDir . 'extract-tmp.jpg';
|
$tmpFile = $tmpDir . 'extract-tmp.jpg';
|
||||||
@@ -61,25 +61,25 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb
|
|||||||
$dimensions = $this->get_dimensions($origine, $this->options['size']);
|
$dimensions = $this->get_dimensions($origine, $this->options['size']);
|
||||||
|
|
||||||
$newHeight = $dimensions['height'];
|
$newHeight = $dimensions['height'];
|
||||||
$newWidth = $dimensions['width'];
|
$newWidth = $dimensions['width'];
|
||||||
|
|
||||||
$system = system_server::get_platform();
|
$system = system_server::get_platform();
|
||||||
|
|
||||||
if ($system == 'WINDOWS')
|
if ($system == 'WINDOWS')
|
||||||
{
|
{
|
||||||
$cmd = $this->binary
|
$cmd = $this->binary
|
||||||
. ' -i ' . $this->escapeshellargs($origine->getPathname())
|
. ' -i ' . $this->escapeshellargs($origine->getPathname())
|
||||||
. ' -s ' . $newWidth . 'x' . $newHeight
|
. ' -s ' . $newWidth . 'x' . $newHeight
|
||||||
. ' -vframes 1 -ss ' . $time_cut
|
. ' -vframes 1 -ss ' . $time_cut
|
||||||
. ' -f image2 ' . $this->escapeshellargs($tmpFile);
|
. ' -f image2 ' . $this->escapeshellargs($tmpFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cmd = $this->binary
|
$cmd = $this->binary
|
||||||
. ' -i ' . $this->escapeshellargs($origine->getPathname())
|
. ' -i ' . $this->escapeshellargs($origine->getPathname())
|
||||||
. ' -s ' . $newWidth . 'x' . $newHeight
|
. ' -s ' . $newWidth . 'x' . $newHeight
|
||||||
. ' -vframes 1 -ss ' . $time_cut
|
. ' -vframes 1 -ss ' . $time_cut
|
||||||
. ' -f image2 ' . $this->escapeshellargs($tmpFile);
|
. ' -f image2 ' . $this->escapeshellargs($tmpFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->shell_cmd($cmd);
|
$this->shell_cmd($cmd);
|
||||||
@@ -87,17 +87,27 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb
|
|||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
$this->log("Commande executee : $cmd \n");
|
$this->log("Commande executee : $cmd \n");
|
||||||
|
|
||||||
if (!file_exists($tmpFile))
|
if ( ! file_exists($tmpFile))
|
||||||
|
{
|
||||||
throw new Exception('Unable to extract image');
|
throw new Exception('Unable to extract image');
|
||||||
|
}
|
||||||
|
|
||||||
$cmd = $this->registry->get('GV_pathcomposite')
|
if (file_exists($this->registry->get('GV_RootPath') . 'www/skins/icons/play.png'))
|
||||||
. ' -gravity SouthEast -quiet -compose over "'
|
{
|
||||||
. $this->registry->get('GV_RootPath') . 'www/skins/icons/play.png"'
|
$cmd = $this->registry->get('GV_pathcomposite')
|
||||||
. ' ' . $this->escapeshellargs($tmpFile)
|
. ' -gravity SouthEast -quiet -compose over "'
|
||||||
. ' ' . $this->escapeshellargs($dest);
|
. $this->registry->get('GV_RootPath') . 'www/skins/icons/play.png"'
|
||||||
|
. ' ' . $this->escapeshellargs($tmpFile)
|
||||||
|
. ' ' . $this->escapeshellargs($dest);
|
||||||
|
|
||||||
|
$this->shell_cmd($cmd);
|
||||||
|
unlink($tmpFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rename($tmpFile, $dest);
|
||||||
|
}
|
||||||
|
|
||||||
$this->shell_cmd($cmd);
|
|
||||||
unlink($tmpFile);
|
|
||||||
rmdir($tmpDir);
|
rmdir($tmpDir);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
Reference in New Issue
Block a user