original_string: protected function create_imagefile_preview(stored_file $file, $mode) {
          global $CFG;
          require_once($CFG->libdir.'/gdlib.php');
  
          if ($mode === 'tinyicon') {
              $data = $file->generate_image_thumbnail(24, 24);
  
          } else if ($mode === 'thumb') {
              $data = $file->generate_image_thumbnail(90, 90);
  
          } else if ($mode === 'bigthumb') {
              $data = $file->generate_image_thumbnail(250, 250);
  
          } else {
              throw new file_exception('storedfileproblem', 'Invalid preview mode requested');
          }
  
          return $data;
      }
code: protected function create_imagefile_preview(stored_file $file, $mode) {
          global $CFG;
          require_once($CFG->libdir.'/gdlib.php');
  
          if ($mode === 'tinyicon') {
              $data = $file->generate_image_thumbnail(24, 24);
  
          } else if ($mode === 'thumb') {
              $data = $file->generate_image_thumbnail(90, 90);
  
          } else if ($mode === 'bigthumb') {
              $data = $file->generate_image_thumbnail(250, 250);
  
          } else {
              throw new file_exception('storedfileproblem', 'Invalid preview mode requested');
          }
  
          return $data;
      }
code_tokens: protected function create_imagefile_preview ( stored_file $ file , $ mode ) { global $ CFG ; require_once ( $ CFG -> libdir . '/gdlib.php' ) ; if ( $ mode === 'tinyicon' ) { $ data = $ file -> generate_image_thumbnail ( 24 , 24 ) ; } else if ( $ mode === 'thumb' ) { $ data = $ file -> generate_image_thumbnail ( 90 , 90 ) ; } else if ( $ mode === 'bigthumb' ) { $ data = $ file -> generate_image_thumbnail ( 250 , 250 ) ; } else { throw new file_exception ( 'storedfileproblem' , 'Invalid preview mode requested' ) ; } return $ data ; }
docstring: Generates a preview for the stored image file
  
  @param stored_file $file the image we want to preview
  @param string $mode preview mode, eg. 'thumb'
  @return string|bool false if a problem occurs, the thumbnail image data otherwise
docstring_tokens: Generates a preview for the stored image file