Example #1
0
 /**
  * Create system file name
  * @param  FileLog $log
  * @param  File    $file
  * @return string
  */
 private function createSystemFileName(FileLog $log, $file)
 {
     return $log->id . '_' . time() . '.' . $file->getClientOriginalExtension();
 }
 /**
  * Create system file name
  * @param  File    $file
  * @return string
  */
 private function createSystemFileName($file)
 {
     return uniqid() . '_' . time() . '.' . $file->getClientOriginalExtension();
 }
Example #3
0
 /**
  * Save shapefile
  * 
  * @param null|File $file
  */
 public function saveShapeFile($file)
 {
     if ($file) {
         $filename = 'shapefile.' . $file->getClientOriginalExtension();
         $file->move($this->getPublicStoragePath(), $filename);
         $this->shapefile_filename = $filename;
         $this->save();
         // Unpack
         $zip = new \ZipArchive();
         $res = $zip->open($this->getPublicStoragePath() . '/' . $filename);
         if ($res === TRUE) {
             $zip->extractTo($this->getPublicStoragePath());
             $zip->close();
             $files = glob($this->getPublicStoragePath() . '/*.shp');
             if (!empty($files)) {
                 $this->shapefile_filename = basename($files[0]);
                 $this->save();
             }
         }
     }
     if ($this->shapefile_filename) {
         $this->shapefile_wmsurl = "http://{$_SERVER['SERVER_NAME']}/cgi-bin/mapserv?map=" . storage_path('layer/' . $this->id . '/mapfile.map') . "&";
         $this->save();
         $this->generateMapfile();
     }
 }