original_string: public function get_file_preview(stored_file $file, $mode) {
  
          $context = context_system::instance();
          $path = '/' . trim($mode, '/') . '/';
          $preview = $this->get_file($context->id, 'core', 'preview', 0, $path, $file->get_contenthash());
  
          if (!$preview) {
              $preview = $this->create_file_preview($file, $mode);
              if (!$preview) {
                  return false;
              }
          }
  
          return $preview;
      }
code: public function get_file_preview(stored_file $file, $mode) {
  
          $context = context_system::instance();
          $path = '/' . trim($mode, '/') . '/';
          $preview = $this->get_file($context->id, 'core', 'preview', 0, $path, $file->get_contenthash());
  
          if (!$preview) {
              $preview = $this->create_file_preview($file, $mode);
              if (!$preview) {
                  return false;
              }
          }
  
          return $preview;
      }
code_tokens: public function get_file_preview ( stored_file $ file , $ mode ) { $ context = context_system :: instance ( ) ; $ path = '/' . trim ( $ mode , '/' ) . '/' ; $ preview = $ this -> get_file ( $ context -> id , 'core' , 'preview' , 0 , $ path , $ file -> get_contenthash ( ) ) ; if ( ! $ preview ) { $ preview = $ this -> create_file_preview ( $ file , $ mode ) ; if ( ! $ preview ) { return false ; } } return $ preview ; }
docstring: Returns an image file that represent the given stored file as a preview
  
  At the moment, only GIF, JPEG and PNG files are supported to have previews. In the
  future, the support for other mimetypes can be added, too (eg. generate an image
  preview of PDF, text documents etc).
  
  @param stored_file $file the file we want to preview
  @param string $mode preview mode, eg. 'thumb'
  @return stored_file|bool false if unable to create the preview, stored file otherwise
docstring_tokens: Returns an image file that represent the given stored file as a preview