}
}
+ $this->getNumberOfPages();
+
$this->filesize = filesize($file);
$this->created = date('Y-m-d H:i:s');
function getNumberOfPages()
{
- $ret = false;
+ $this->no_of_pages = 0;
require_once 'System.php';
+ $file = $this->getStoreName();
+
+ if(!file_exists($file)){
+ return;
+ }
+
switch ($this->mimetype) {
case 'application/pdf' :
- $file = $this->getStoreName();
-
- if(!file_exists($file)){
- return false;
- }
-
$pdftk = System::which('pdftk');
if (empty($pdftk)) {
$cmd = "{$pdftk} {$file} dump_data";
- $test = `$cmd`;
+ $info = `$cmd`;
- print_R($test);exit;
+ $infos = explode("\n", $info);
+
+ foreach ($infos as $i){
+
+ if(!preg_match('/^NumberOfPages: ([0-9]+)/', $i, $matches)){
+ continue;
+ }
+
+ $ret = (empty($matches[1])) ? false : $matches[1];
+ break;
+ }
break;
default :