private function GetThumbnailFileName($original_file_name, $original_file_extension, $file_size) { $result = ''; $handled = false; $this->generateFileNameDelegate->CallFromArray(array(&$result, &$handled, $original_file_name, $original_file_extension, $file_size)); $targetFolder = FormatDatasetFieldsTemplate($this->GetDataset(), $this->directoryToSaveThumbnails); FileUtils::ForceDirectories($this->directoryToSaveThumbnails); if (!$handled) { $filename = FileUtils::AppendFileExtension(rand(), $original_file_extension); $result = Path::Combine($targetFolder, $filename); while (file_exists($result)) { $filename = FileUtils::AppendFileExtension(rand(), $original_file_extension); $result = Path::Combine($targetFolder, $filename); } } return $result; }