- file_unmanaged_move($tmp_file, $destination, FILE_CREATE_DIRECTORY);
- if ($path = $random->image(drupal_realpath($destination), $min_resolution, $max_resolution)) {
+ file_unmanaged_move($tmp_file, $destination);
+ if ($path = $random->image(\Drupal::service('file_system')->realpath($destination), $min_resolution, $max_resolution)) {