public function apply($absolutePath)
    {
        $info = pathinfo($absolutePath);

        if (isset($info['extension']) && false !== strpos(strtolower($info['extension']), 'pdf') && file_exists($absolutePath)) {
            // If it doesn't exist yet, extract the first page of the PDF
            $previewFilename = $this->getPreviewFilename($absolutePath);
            if (!file_exists($previewFilename)) {
                $this->imagick->readImage($absolutePath . '[0]');
                $this->imagick->setImageFormat('jpg');
                $this->imagick->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
                $this->imagick->writeImage($previewFilename);
                $this->imagick->clear();
            }

            $absolutePath = $previewFilename;
        }

        return $absolutePath;
    }