vivekanand pathak - 2013-02-06 17:37:03
//the code is here for converting document to swf . but when i m trying to use it in an array than its not executing .
## it is for single document convertion
if($ext == '.jpg' || $ext == '.jpeg')
{
//"/usr/local/bin/png2swf '". realpath(APPPATH.'../uploads/')."/".$filename."' -o '". realpath(APPPATH.'../uploads/')."/".time()."testswf.swf'";
$cmd1 ='/usr/local/bin/jpeg2swf "'.realpath(APPPATH.'../uploads/'.$filename).'" -o "'.realpath(APPPATH.'../uploads/').'/'.$time.$newfname.'.swf" -T 9 -q 100';
$output = shell_exec($cmd1);
}
else if($ext == '.png' || $ext == '.PNG')
{
$cmd1 = '/usr/local/bin/png2swf "'.realpath(APPPATH.'../uploads/'.$filename).'" -o "'.realpath(APPPATH.'../uploads/').'/'.$time.$newfname.'.swf" -T 9';
$output = shell_exec($cmd1);
}
else
{
if($ext !='.pdf')
{
//docs to pdf ka code aye ga
$cmd1 = '/usr/bin/unoconv -f pdf '.realpath(APPPATH.'../uploads/'.$filename).'';
//echo $cmd1;
$output = exec($cmd1);
//echo $output;
//die();
}
$pages = shell_exec("identify -format %n '".realpath(APPPATH.'../uploads/').'/'.$time.$newfname.".pdf'");
$data['pages']=$pages;
if($size<=$max_filesize)
{
$cmd1 = '/usr/local/bin/pdf2swf "'.realpath(APPPATH.'../uploads/'.$time.$newfname.'.pdf').'" -o "'.realpath(APPPATH.'../uploads/').'/'.$time.$newfname.'.swf" -f -T 9 -t -s storeallcharacters';
$output = shell_exec($cmd1);
//exec('convert -scale 128 -colorspace "CMYK" "'.$folder_path."/".$folder_name."/".$assignment_head."/".$filename_guid.'.pdf[0]" "'.$folder_path."/".$folder_name."/".$assignment_head."/".$filename_guid.'.png"');
}
else
{
$data['is_splitted']='yes';
$cmd2 = '/usr/local/bin/pdf2swf "'.realpath(APPPATH.'../uploads/'.$time.$newfname.'.pdf').'" -o "'.realpath(APPPATH.'../uploads/').'/'.$time.$newfname."%".'.swf" -f -T 9 -t -s storeallcharacters';
$output = shell_exec($cmd2);
//exec('convert -scale 128 -colorspace "CMYK" "'.$folder_path."/".$folder_name."/".$assignment_head."/".$filename_guid.'.pdf[0]" "'.$folder_path."/".$folder_name."/".$assignment_head."/".$filename_guid.'.png"');
}
}