/** * @param File $file * @return string */ protected function getThumbnailURLForFile(File $file) { if ($file->exists() && file_exists(Director::baseFolder() . '/' . $file->getFilename())) { $width = $this->getPreviewMaxWidth(); $height = $this->getPreviewMaxHeight(); if ($file->hasMethod('getThumbnail')) { $r = $file->getThumbnail($width, $height); if ($r) { return $r->getURL(); } } elseif ($file->hasMethod('getThumbnailURL')) { return $file->getThumbnailURL($width, $height); } elseif ($file->hasMethod('Fit')) { $r = $file->Fit($width, $height); if ($r) { return $r->getURL(); } } else { return $file->Icon(); } } return false; }