예제 #1
0
 /**
  * Move a file to a new location.
  *
  * @param string $from
  * @param string $to
  * @return bool 
  * @static 
  */
 public static function move($from, $to)
 {
     return \Illuminate\Filesystem\FilesystemAdapter::move($from, $to);
 }
예제 #2
0
 /**
  * Renames existing file
  *
  * @param string $oldFileName
  * @param string $newFileName
  * @param string $context
  * @param FilesystemAdapter $filesystemAdapter
  *
  * @return boolean
  */
 public function rename($oldFileName, $newFileName, $context, FilesystemAdapter $filesystemAdapter)
 {
     if ($filesystemAdapter->exists($context . '/' . $newFileName)) {
         throw new IcrRuntimeException("File with name {$newFileName} already exists!");
     }
     $image = $filesystemAdapter->get($context . '/' . $oldFileName);
     $filesystemAdapter->move($context . '/' . $oldFileName, $context . '/' . $newFileName);
     foreach ($this->config[$context] as $sizeName => $value) {
         $oldPath = $context . '/' . $sizeName . '/' . $oldFileName;
         $newPath = $context . '/' . $sizeName . '/' . $newFileName;
         $filesystemAdapter->move($oldPath, $newPath);
     }
     return true;
 }