19 include_once (
"FDL/Class.Doc.php");
20 include_once (
"FDL/Class.TaskRequest.php");
21 include_once (
"WHAT/Class.TEClient.php");
22 include_once (
"Lib.FileMime.php");
43 if (!
$tid)
$err = _(
"no task identificator found");
49 $outfile = $info[
"outfile"];
50 $status = $info[
"status"];
52 if (($status ==
'D') && ($outfile !=
'')) {
55 $err =
$vf->Retrieve($vidin, $infoin);
56 $err =
$vf->Retrieve($vidout, $infoout);
58 $err =
$vf->Retrieve($vidout, $infoout);
60 if ($ext ==
"") $ext = $infoout->teng_lname;
66 $pp = strrpos($infoin->name,
'.');
67 $newname = substr($infoin->name, 0, $pp) .
'.' . $ext;
70 $vf->Rename($vidout, $newname);
71 $vf->storage->teng_state = 1;
72 $vf->storage->modify();
74 if ($engine ==
"pdf") {
82 $err =
$vf->Retrieve($vidin, $infoin);
83 $err =
$vf->Retrieve($vidout, $infoout);
86 $error = sprintf(_(
"Conversion as %s has failed ") , $infoout->teng_lname);
87 $error.=
"\n== " . _(
"See below information about conversion") .
"==\n" . print_r($info,
true);
90 $vf->Retrieve($vidout, $infoout);
92 $basename = _(
"conversion error") .
".txt";
93 $vf->Rename($vidout, $basename);
95 $vf->storage->modify();
98 if (
$doc->isAlive()) {
99 $doc->addComment(sprintf(_(
"convert file %s as %s failed") , $infoin->name, $infoout->teng_lname) ,
HISTO_ERROR);
107 else $action->lay->template =
"OK : " . sprintf(_(
"vid %d stored") , $vidout);
116 $dbaccess = $action->GetParam(
"FREEDOM_DB");
122 if ($tr->isAffected()) {
123 $outfile = $info[
"outfile"];
124 $status = $info[
"status"];
126 if (($status ==
'D') && ($outfile !=
'')) {
132 $err = sprintf(_(
"task %s is not recorded") ,
$tid);
139 if (file_exists(
$file) && ($vid > 0)) {
142 $nbpages = trim(shell_exec(sprintf(
'grep -c "/Type[[:space:]]*/Page>" %s', escapeshellarg(
$file))));
143 $cmd[] = sprintf(
"/bin/rm -f %s/vid-%d*.png;",
DEFAULT_PUBDIR .
"/.img-resize", $vid);
145 for ($i = 0; $i < $nbpages; $i++) {
148 $cmd[] = sprintf(
"nice convert -interlace plane -thumbnail %d -density %d %s[%d] %s", $width, $density,
$file, $i, $cible);