$roo->jerr("File upload failed : error = ". (!empty($this->err) ? $this->err : ''));
}
- $roo->addEvent("ADD", $this, $this->toEventString());
+ $this->addEvent($ar, $roo);
$r = DB_DataObject::factory($this->tableName());
$r->id = $this->id;
}
+ function addEvent($ar, $roo)
+ {
+ $roo->addEvent("ADD", $this, $this->toEventString());
+ }
+
function toEventString()
{
return false;
}
- require_once 'File/MimeType.php';
-
- $imageInfo = getimagesize($file);
-
- $y = new File_MimeType();
-
- $ext = $y->toExt(trim((string) $imageInfo['mime'] ));
-
$data = file_get_contents($file);
- $base64 = 'data:image/' . $ext . ';base64,' . base64_encode($data);
+ $base64 = 'data:' . $this->mimetype . ';base64,' . base64_encode($data);
return $base64;
}
+ function getNumberOfPages()
+ {
+ $ret = false;
+
+ require_once 'System.php';
+
+ switch ($this->mimetype) {
+
+ case 'application/pdf' :
+
+ $file = $this->getStoreName();
+
+ if(!file_exists($file)){
+ return false;
+ }
+
+ $pdftk = System::which('pdftk');
+
+ if (empty($pdftk)) {
+ return false;
+ }
+
+
+
+ break;
+ default :
+ break;
+ }
+
+ return $ret;
+ }
+
}