mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
V 3.5 RC 1
This commit is contained in:
35
lib/classes/binaryAdapter/flash/toimage.class.php
Normal file
35
lib/classes/binaryAdapter/flash/toimage.class.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_flash_toimage extends binaryAdapter_adapterAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $processors = array(
|
||||
'binaryAdapter_flash_toimage_swfextract',
|
||||
'binaryAdapter_flash_toimage_swfrender'
|
||||
);
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'Binary adapter flash to image';
|
||||
}
|
||||
|
||||
}
|
82
lib/classes/binaryAdapter/flash/toimage/swfextract.class.php
Normal file
82
lib/classes/binaryAdapter/flash/toimage/swfextract.class.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_flash_toimage_swfextract extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binary_name = 'GV_swf_extract';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return binaryAdapter_flash_toimage_swfextract
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$cmd = sprintf('%s %s'
|
||||
, $this->binary
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
);
|
||||
|
||||
$stdout = $this->shell_cmd($cmd);
|
||||
|
||||
$id = false;
|
||||
|
||||
foreach ($stdout as $l)
|
||||
{
|
||||
if (substr(trim($l), 0, 4) == '[-j]')
|
||||
{
|
||||
$id = ' -j '
|
||||
. array_pop(explode('-', array_pop(explode(' ', trim($l)))));
|
||||
$ext = '.jpg';
|
||||
break;
|
||||
}
|
||||
if (substr(trim($l), 0, 4) == '[-p]')
|
||||
{
|
||||
$id = ' -p '
|
||||
. array_pop(explode('-', array_pop(explode(' ', trim($l)))));
|
||||
$ext = '.png';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$cmd = sprintf('%s %s %s -o %s'
|
||||
, $this->binary
|
||||
, $id
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
52
lib/classes/binaryAdapter/flash/toimage/swfrender.class.php
Normal file
52
lib/classes/binaryAdapter/flash/toimage/swfrender.class.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_flash_toimage_swfrender extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binary_name = 'GV_swf_render';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return binaryAdapter_flash_toimage_swfrender
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
|
||||
$cmd = sprintf('%s -l %s -o %s'
|
||||
, $this->binary
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user