X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FImages.php;h=3db1921945d267ba5aad530ff6c0653c6b8d17e4;hp=4b75ccad9d47620c7e2f28d5e94db1bd075ced1b;hb=62669e8967ab69e530f03c9d559eb5ff64b8e929;hpb=3c9e45540f5f1fb277d5047937942dc0a0dccd1d diff --git a/DataObjects/Images.php b/DataObjects/Images.php index 4b75ccad..3db19219 100644 --- a/DataObjects/Images.php +++ b/DataObjects/Images.php @@ -131,7 +131,33 @@ class Pman_Core_DataObjects_Images extends DB_DataObject } } - $this->getNumberOfPages($file); + if($this->mimetype == 'application/pdf'){ + require_once 'System.php'; + + $this->no_of_pages = 0; + + $pdfinfo = System::which('pdfinfo'); + + if (!empty($pdfinfo)) { + + $cmd = "{$pdfinfo} {$file}"; + + $ret = `$cmd`; + + $info = explode("\n", $ret); + + foreach ($info as $i){ + + if(!preg_match('/^Pages:[\s]?([0-9]+)/', $i, $matches)){ + continue; + } + print_R($matches);exit; + $ret = (empty($matches[1])) ? false : $matches[1]; + break; + } + } + + } $this->filesize = filesize($file); $this->created = date('Y-m-d H:i:s');