diff --git a/Classes/Service/CachedImageService.php b/Classes/Service/CachedImageService.php index 700d8e6702feeb988392c268645e0dd1b8c29c0e..b45774f9ab6eae136308ea1828f1fb200b7371cc 100644 --- a/Classes/Service/CachedImageService.php +++ b/Classes/Service/CachedImageService.php @@ -119,22 +119,24 @@ class CachedImageService { $imageHash = \md5($url); // check if any kind of image with this hash is already in the cache-directory $cachedImage = \glob($cachedImageFolderPath . $imageHash . '.*'); + $cachedFileWebPath = ''; if (count($cachedImage) <= 0) { // if the cache-directory has not been created yet, do so GeneralUtility::mkdir_deep($cachedImageFolderPath); - // copy without file extension for now - \copy($url, $cachedImageFolderPath . $imageHash); - $imageType = \exif_imagetype($cachedImageFolderPath . $imageHash); + if (@\copy($url, $cachedImageFolderPath . $imageHash)) { + // copy without file extension for now + $imageType = \exif_imagetype($cachedImageFolderPath . $imageHash); - // figure out the file extension based on the image's mime-type - $cachedFileName = $imageHash . \image_type_to_extension($imageType); - $cachedFilePath = $cachedImageFolderPath . $cachedFileName; + // figure out the file extension based on the image's mime-type + $cachedFileName = $imageHash . \image_type_to_extension($imageType); + $cachedFilePath = $cachedImageFolderPath . $cachedFileName; - // correct name - \rename($cachedImageFolderPath . $imageHash, $cachedFilePath); - GeneralUtility::fixPermissions($cachedFilePath); - $cachedFileWebPath = PathUtility::getAbsoluteWebPath($cachedFilePath); + // correct name + \rename($cachedImageFolderPath . $imageHash, $cachedFilePath); + GeneralUtility::fixPermissions($cachedFilePath); + $cachedFileWebPath = PathUtility::getAbsoluteWebPath($cachedFilePath); + } } else { $cachedFileWebPath = PathUtility::getAbsoluteWebPath($cachedImage[0]); }