-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Implement core support for | resize(width, height, options)
filter
#5231
Conversation
@LukeTowers so this is improving the getThumb() in that it can work on an image from the media library in ADDITION TO an image object ? |
Sort of, this will rewrite the getThumb logic to be located in a more generic place and support handling File models, Media library items, and hopefully any other asset that the application can access (plugin / theme assets, etc) |
…instead of static methods on a helper class
Refactored resizer URLs to support custom disks, switched to using a signed version of the resized image's URL as the identifier for the configuration
…tial WIP on supporting File models
…ls, initial support for detecting completed resize operations
$resizedUrl = ImageResizer::getValidResizedUrl($identifier, $encodedUrl); | ||
if (empty($resizedUrl)) { | ||
return response('Invalid identifier or redirect URL', 400); | ||
} |
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.
@bennothommo could we get a unit test for both of these code paths (correctly signed URL being validated vs incorrectly signed URL being rejected)?
…age sources, added the storage/app/resized directory to the mirror command
…to wip/image-resizing
Awesome work with this, @LukeTowers! |
Thanks @bennothommo, I'm looking forward to getting this into production! |
PHP 7.2 doesn't like them, apparently.
@LukeTowers unless I'm mistaken, it appears the new events provided in this functionality won't fire for file models, so plugins extending this functionality wouldn't be able apply optimisations to uploaded files. Should these events be extended to those types of sources too? EDIT: I mean the |
@LukeTowers I never got a response to my comment about the beforeResize event being documented but not fired anywhere... |
@mjauvin sorry, didn't see that. After thinking about it I couldn't find a legitimate use case for it so I didn't implement it. Still need to clean up the inline docs. |
… after being retrieved from the cache
Document new Image Resizing functionality. Related: octobercms/october#5231
Hello, Is there some documentation somewhere about this new core filter ? I looked for some doc on the octobercms website without success. Thank you |
Yes, it'll be added to the marketplace site when 1.1 is available on the marketplace, until then use the RainLab.Docs plugin or look at the docs repo directly: https://github.com/octobercms/docs/blob/master/services-image-resizing.md, https://github.com/octobercms/docs/blob/master/markup-filter-resize.md, https://github.com/octobercms/docs/blob/master/markup-filter-image-width.md, https://github.com/octobercms/docs/blob/master/markup-filter-image-height.md |
Fixes #5059.
Example post processing plugin here: https://github.com/LukeTowers/oc-tinypng-plugin
Related PRs:
Replaces:
Remaining work:
| imageHeight
,| imageWidth
filterstype: image
column typeUnit tests to be completed:
| imageWidth
and| imageHeight
filters return the correct values| resize()
filter returns the original string if unable to create a valid image from it0
internally