public static function Watermark::flushImageStylesCache in Media watermark 8
Helper to flush image cache only for updated images.
Parameters
string $file_uri: File internal drupal path.
1 call to Watermark::flushImageStylesCache()
- Watermark::createImage in src/
Watermark/ Watermark.php - Function to create image (.jpg, .jpeg, .png, .gif) file.
File
- src/
Watermark/ Watermark.php, line 175
Class
- Watermark
- Custom watermark class.
Namespace
Drupal\media_watermark\WatermarkCode
public static function flushImageStylesCache(string $file_uri) {
$styles = ImageStyle::loadMultiple();
if (!empty($styles) && is_array($styles)) {
foreach ($styles as $style) {
if (method_exists($style, 'flush')) {
$style
->flush($file_uri);
}
else {
// Log error about flushing image styles.
$message = t('Method flush() is not available into ImageStyle class');
\Drupal::logger('media_watermark')
->error($message);
}
}
}
}