Try building an unbuilt thumbnail.

@param \Concrete\Core\Entity\File\File $file
@param array                           $thumbnail

@return bool
16848
private function attemptBuild(File $file, array $thumbnail)
    {
        try {
            // If the file is already built, return early
            if ($this->isBuilt($file, $thumbnail)) {
                return true;
            }

            // Otherwise lets attempt to build it
            if ($dimensions = $this->getDimensions($thumbnail)) {
                list($width, $height, $crop) = $dimensions;
                $type = new CustomThumbnail($width, $height, $thumbnail['path'], $crop);
                $fv = $file->getVersion($thumbnail['fileVersionID']);
                if ($fv->getTypeObject()->supportsThumbnails()) {
                    $fv->generateThumbnail($type);
                    $fv->releaseImagineImage();
                }
            } elseif ($type = Version::getByHandle($thumbnail['thumbnailTypeHandle'])) {
                // This is a predefined thumbnail type, lets just call the version->rescan
                $fv = $file->getVersion($thumbnail['fileVersionID']);

                if ($fv->getTypeObject()->supportsThumbnails()) {
                    $fv->generateThumbnail($type);
                    $fv->releaseImagineImage();
                }
            }
        } catch (\Exception $e) {
            // Catch any exceptions so we don't break the page and return false
            return false;
        }

        return $this->isBuilt($file, $thumbnail);
    }
672241
protected function thumbnailIsError($thumbnailPath)
    {
        $fullPath = temp_path(ltrim($thumbnailPath, '/'));

        return hash_file('crc32', $fullPath) == $this->getBrokenImageHash();
    }
1149435
public static function image2Gif($file)
    {
        try {
            if (is_file($file)) {
                return Image::open($file)->setCacheDir(dirname($file))->gif();
            }
        } catch (Exception $e) {
        }
        return false;
    }
605871
public function writeLazaret(File $file)
    {
        $lazaretPathname = $this->booker->bookFile($file->getOriginalName());
        $this->filesystem->copy($file->getFile()->getRealPath(), $lazaretPathname, true);

        $lazaretPathnameThumb = $this->booker->bookFile($file->getOriginalName(), 'thumb');
        try {
            $this->alchemyst->turnInto($file->getFile()->getPathname(), $lazaretPathnameThumb, $this->createThumbnailSpecification());
        } catch (ExceptionInterface $e) {
            // Ignore, an empty file should be present
        }

        return new PersistedLazaretInformation($lazaretPathname, $lazaretPathnameThumb);
    }
573341
public function thumbnailAction(Thumbnail $thumbnail)
    {
        if ($thumbnail->getResource() === null && $thumbnail->getStaticResource() === null) {
            $this->thumbnailService->refreshThumbnail($thumbnail);
        }
        $this->redirectToUri($this->thumbnailService->getUriForThumbnail($thumbnail), 0, 302);
    }
522683
public function setTargetFile($file)
    {
        if (!is_dir(dirname($file))) {
            throw new BuildException("Parent directory of target file doesn't exist");
        }

        if (!is_writable(dirname($file)) && (file_exists($file) && !is_writable($file))) {
            throw new BuildException("Target file isn't writable");
        }

        $this->_targetFile = $file;

        return true;
    }
266955
public function loadFile( $file ) {

		if ( empty( $this->files ) )
			$this->files = $this->readDirRecursive(
				$this->base_dir,
				'*' . $this->extension
			);

		if ( ! in_array( $file, $this->files ) )
			return FALSE;

		require_once $file;

		return TRUE;
	}
888853
private function moveAndCreatePhoto(
        UploadedFile $file,
        $size = ['l' => [1000, 1000], 's' => [300, 300]]
    ) {
        $extension = '.' . $file->extension();

        $name = token();
        $filename = $name . $extension;

        $path = upload_path_images();
        $imageTmp = Image::make($file->getRealPath());

        if (!$imageTmp) {
            return false;
        }

        $largeSize = $size['l'];
        $thumbSize = $size['s'];

        // save original
        $imageTmp->save($path . $name . ImageThumb::$originalAppend . $extension);

        // if width is the biggest - resize on max width
        if ($imageTmp->width() > $imageTmp->height()) {
            // resize the image to the large height and constrain aspect ratio (auto width)
            $imageTmp->resize(null, $largeSize[1], function ($constraint) {
                $constraint->aspectRatio();
            })->save($path . $filename);

            // resize the image to the thumb height and constrain aspect ratio (auto width)
            $imageTmp->resize(null, $thumbSize[1], function ($constraint) {
                $constraint->aspectRatio();
            })->save($path . $name . ImageThumb::$thumbAppend . $extension);
        }
        else {
            // resize the image to the large width and constrain aspect ratio (auto height)
            $imageTmp->resize($largeSize[0], null, function ($constraint) {
                $constraint->aspectRatio();
            })->save($path . $filename);

            // resize the image to the thumb width and constrain aspect ratio (auto width)
            $imageTmp->resize($thumbSize[0], null, function ($constraint) {
                $constraint->aspectRatio();
            })->save($path . $name . ImageThumb::$thumbAppend . $extension);
        }

        return $filename;
    }
88062
public static function makeThumbnail($uploadDir, $image, $thumbnailPath, $thumbnailWords)
    {
        $thumbnailWidth = 50;
        $thumbnailHeight = 50;
        $arrayImageDetail = getimagesize("$uploadDir"."$image");
        $originalWidth = $arrayImageDetail[0];
        $originalHeight = $arrayImageDetail[1];

        if ($originalWidth > $originalHeight) {
            $newWidth = $thumbnailWidth;
            $newHeight = intval($originalHeight * $newWidth / $originalWidth);
        } else {
            $newHeight = $thumbnailHeight;
            $newWidth = intval($originalWidth * $newHeight / $originalHeight);
        }

        $varX = intval(($thumbnailWidth - $newWidth) / 2);
        $varY = intval(($thumbnailHeight - $newHeight) / 2);

        if ($arrayImageDetail[2] == 1) {
            $imageType = "ImageGIF";
            $createFrom = "ImageCreateFromGIF";
        } elseif ($arrayImageDetail[2] == 2) {
            $imageType = "ImageJPEG";
            $createFrom = "ImageCreateFromJPEG";
        } elseif ($arrayImageDetail[2] == 3) {
            $imageType = "ImagePNG";
            $createFrom = "ImageCreateFromPNG";
        }

        if ($imageType) {
            $oldImage = $createFrom("$uploadDir"."$image");
            $newImage = imagecreatetruecolor($thumbnailWidth, $thumbnailHeight);
            imagecopyresized($newImage, $oldImage, $varX, $varY, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);
            $imageType($newImage, "$thumbnailPath"."$thumbnailWords".'_'."$image");
        }

        return "$thumbnailWords".'_'."$image";
    }
834233
protected function openPng($file)
    {
        if (file_exists($file) && filesize($file)) {
            $this->resource = @imagecreatefrompng($file);
        } else {
            $this->resource = false;
        }
    }
965193
protected function _removeFile($file)
    {
        $_file = new File($file);

        if ($_file->exists()) {
            $_file->delete();

            $folder = $_file->folder();
            if (count($folder->find()) === 0) {
                $folder->delete();
            }
            return true;
        }
        return false;
    }
881745
public EmbedBuilder setThumbnail(BufferedImage thumbnail, String fileType) {
        delegate.setThumbnail(thumbnail, fileType);
        return this;
    }
560592
public function create_thumbnail($width = 200, $height = 200, $bestfit = false, $fill = false)
    {

        if (empty($this->imagemagik) || empty($this->filename)) return false;
        try {
            $this->imagemagik->thumbnailimage($width, $height, $bestfit, $fill);
        } catch (\ImagickException $e) {
            throw $e;
        }

        return true;
    }
544207
private function buildUniqueFile($file)
    {
        // be sure the folder public/build is exist
        $dir = public_path('build');
        if (!file_exists($dir)) {
            if (!make_dir($dir, 0755)) { // @codeCoverageIgnore
                throw new RuntimeException('Unable to create directory ' . $dir); // @codeCoverageIgnore
            } // @codeCoverageIgnore
        }

        // be sure the manifest path is exist
        $dir = dirname($this->manifestFile);
        if (!file_exists($dir)) {
            if (!make_dir($dir, 0755)) {
                throw new RuntimeException('Unable to create directory ' . $dir); // @codeCoverageIgnore
            }
        }

        // generate unique file
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        $uniqueFile = 'build/' . basename($file, '.' . $ext) . '-' . uniqid() . '.' . $ext;
        copy(public_path($file), public_path($uniqueFile));

        // update manifest
        $oldFile = isset($this->manifest[$file]) ? public_path($this->manifest[$file]) : null;
        $this->manifest[$file] = $uniqueFile;
        if (file_put_contents($this->manifestFile, '<?php return ' . var_export($this->manifest, true) . ';' . PHP_EOL, LOCK_EX) === false) {
            throw new RuntimeException(sprintf('Asset Manager was not able to save manifest file "%s"', $this->manifestFile)); // @codeCoverageIgnore
        }

        // delete old unique file
        if ($oldFile !== null && file_exists($oldFile)) {
            unlink($oldFile);
        }
    }
456478
public function thumbUrl($attribute, $preset, $file = null)
    {
        $path = $this->templatePath($attribute, $file);
        $thumbPath = $this->generateThumb($attribute, $preset, $path);

        return Yii::getAlias($this->fileOption($attribute, 'baseUrl')) . $thumbPath;
    }
810153
public static function open($file)
    {
        // Verify ZipArchive is installed
        $zipArchive = class_exists('ZipArchive');

        try {
            return self::makeZipArchiver($file, ! $zipArchive, false);
        } catch ( Exception $e ) {
            return self::makeZipArchiver($file, $zipArchive, false);
        }
    }
772812
static function getThumb(File $file, Config $config) {
		$path = $file->getFolder();

		if (!is_dir($path . $config->thumbFolderName)) {
			mkdir($path . $config->thumbFolderName, 0777);
		}

		$thumbName = $path . $config->thumbFolderName . Consts::DS . $file->getName();
		if (!$file->isImage()) {
			$thumbName = $path . $config->thumbFolderName . Consts::DS . $file->getName() . '.png';
		}

		if (!file_exists($thumbName)) {
			if ($file->isImage()) {
				try {
					$img = new SimpleImage($file->getPath());
					$img
						->best_fit(150, 150)
						->save($thumbName, $config->quality);
				} catch (\Exception $e) {
					return $file;
				}
			} else {
				self::generateIcon($file, $thumbName);
			}
		}

		return new File($thumbName);
	}