public function change_ext($ext, $file){
    if ( !empty($ext) &&
      !empty($file) &&
      file_exists($file)
    ){
      $pi = pathinfo($file);
      $new = $pi['dirname'].'/'.$pi['filename'].'.'.$ext;
      bbn\file\dir::move($file, $new, true);
      return [
        'file' => $new,
        'file_url' => $this->real_to_url($new)
      ];
    }
    $this->error("Error.");
  }
public function change_ext($ext, $file){
    if ( !empty($ext) &&
      !empty($file) &&
      file_exists($file)
    ){
      $pi = pathinfo($file);
      $new = $pi['dirname'].'/'.$pi['filename'].'.'.$ext;
      bbn\file\dir::move($file, $new, true);
      return [
        'file' => $new,
        'file_url' => $this->real_to_url($new)
      ];
    }
    $this->error("Error.");
  }
public function change_ext ( $ ext , $ file ) { if ( ! empty ( $ ext ) && ! empty ( $ file ) && file_exists ( $ file ) ) { $ pi = pathinfo ( $ file ) ; $ new = $ pi [ 'dirname' ] . '/' . $ pi [ 'filename' ] . '.' . $ ext ; bbn \ file \ dir :: move ( $ file , $ new , true ) ; return [ 'file' => $ new , 'file_url' => $ this -> real_to_url ( $ new ) ] ; } $ this -> error ( "Error." ) ; }
Changes the extension to a file.

@param string $ext The new extension
@param string $file The file to change
@return array
Changes the extension to a file .