public function TextimageFactory::flushStyle in Textimage 8.3
Same name and namespace in other branches
- 8.4 src/TextimageFactory.php \Drupal\textimage\TextimageFactory::flushStyle()
Flushes Textimage style data.
Clears immediate cache and all the image files associated.
Parameters
\Drupal\image\ImageStyleInterface $style: The style being flushed.
Overrides TextimageFactoryInterface::flushStyle
File
- src/
TextimageFactory.php, line 215
Class
- TextimageFactory
- Provides a factory for Textimage.
Namespace
Drupal\textimageCode
public function flushStyle(ImageStyleInterface $style) {
// Clear hashed filename images.
$wrappers = $this->streamWrapperManager
->getWrappers(StreamWrapperInterface::WRITE_VISIBLE);
foreach ($wrappers as $wrapper => $wrapper_data) {
if (file_exists($directory = $this
->getStoreUri('/cache/styles/', $wrapper) . $style
->id())) {
file_unmanaged_delete_recursive($directory);
}
}
// Clear public textimage directory.
if (file_exists($directory = 'public://textimage/' . $style
->id())) {
file_unmanaged_delete_recursive($directory);
}
}