mirror of
https://github.com/getgrav/grav.git
synced 2026-06-25 08:01:12 +02:00
Cleanup unused method ImageMediaTrait::generateCacheImage()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user