Cleanup unused method ImageMediaTrait::generateCacheImage()

This commit is contained in:
Matias Griese
2022-05-12 20:38:25 +03:00
parent ea842aef0a
commit 28e2c9bbef

View File

@@ -812,39 +812,6 @@ trait ImageMediaTrait
}
return GRAV_WEBROOT . $imageFile;
//return $this->generateCacheImage(GRAV_WEBROOT . $imageFile);
}
/**
* @param string $filepath
* @return string
* @phpstan-impure
*/
protected function generateCacheImage(string $filepath): string
{
if (file_exists($filepath)) {
return $filepath;
}
try {
$fileData = $this->readFile();
$adapter = GdAdapter::createFromString($fileData);
$image = $this->image;
$image->setAdapter($adapter);
$image->save($filepath, 'jpg', $this->quality);
$image->freeAdapter();
} catch (RuntimeException $e) {
/** @var Debugger $debugger */
$debugger = Grav::instance()['debugger'];
$debugger->addMessage(sprintf('Could not generate resized image for %s: %s', $this->filename, $e->getMessage()), 'warning');
// FIXME: Fallback image?
return '';
}
return $filepath;
}
/**