load() публичный Метод

public load ( $path )
$path
Пример #1
0
 /**
  * @param $path
  * @return $this
  * @throws \Exception
  */
 public function load($path)
 {
     $path = $this->preparePath($path);
     // avoid timeouts
     $maxExecTime = (int) ini_get("max_execution_time");
     if ($maxExecTime > 1 && $maxExecTime < 250) {
         set_time_limit(250);
     }
     if (!$this->isFileTypeSupported($path)) {
         $message = "Couldn't load document " . $path . " only Microsoft/Libre/Open-Office/PDF documents are currently supported";
         Logger::error($message);
         throw new \Exception($message);
     }
     // first we have to create a pdf out of the document (if it isn't already one), so that we can pass it to ghostscript
     // unfortunately there isn't an other way at the moment
     if (!preg_match("/\\.?pdf\$/", $path)) {
         if (!parent::isFileTypeSupported($path)) {
             $this->path = $this->getPdf($path);
         }
     } else {
         $this->path = $path;
     }
     parent::load($this->path);
     return $this;
 }