Skip to content

Commit d1a6041

Browse files
committed
Add hook example
Signed-off-by: Philipp Daun <post@philippdaun.net>
1 parent 6480e65 commit d1a6041

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ each other. This allows smoother animations between the blurry unloaded and the
100100
</div>
101101
```
102102

103+
## Hooks
104+
105+
You can hook into the placeholder generation process to modify the generated placeholder data URIs.
106+
The example below will prevent placeholder output for possibly transparent image types.
107+
108+
```php
109+
wire()->addHookAfter('ImagePlaceholders::getPlaceholderDataUri', function (HookEvent $e) {
110+
$image = $e->arguments('image');
111+
if ($image->ext === 'png' || $image->ext === 'gif') {
112+
$e->return = '';
113+
}
114+
});
115+
```
116+
103117
## Support
104118

105119
Please [open an issue](https://github.com/daun/processwire-image-placeholders/issues/new) for support.

0 commit comments

Comments
 (0)