-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/allow imgproxy url modification #11
base: main
Are you sure you want to change the base?
Changes from all commits
6bb8e64
3f6758d
8e39f19
f2ec718
5fad8cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,4 +76,9 @@ public function cacheBuster(string $cacheBuster) | |
{ | ||
$this->processingOptions[] = 'cb:' . $cacheBuster; | ||
} | ||
|
||
public function addProcessingOption($key, $value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $key can be type-hinted with |
||
{ | ||
$this->processingOptions[] = $key . ':' . $value; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,25 @@ docker run -p 8080:8080 -it \ | |
* Neos will **not generate any thumbnail**, they are generated ad-hoc from imgproxy as soon as a client requests it. | ||
|
||
Note: make sure to add a caching proxy / CDN on top of imgproxy, it has no built-in caching! | ||
|
||
## How to modify the imgproxy url | ||
If you need to modify the imgproxy url for your custom needs you can use the following hook: | ||
1. Create a modifier class in this format: | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add |
||
namespace Foo\Bar; | ||
|
||
class ModifierClass | ||
{ | ||
public function __invoke(ImgproxyUrl $url, ThumbnailConfiguration $configuration): void | ||
{ | ||
// modify the ImgproxyUrl object | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add call to the new function here? |
||
} | ||
} | ||
``` | ||
2. Register your modifier in the settings: | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add yaml here |
||
Networkteam: | ||
ImageProxy: | ||
imgproxyUrlModifiers: | ||
- Foo\Bar\ModifierClass | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO
class_exists()
andis_callable()
should be removed here. When class does not exist or isn't callable, then i prefer to get an Exception and to know i made a mistake.