[6.x] Driver based image manipulation with render tag#10204
Closed
jasonvarga wants to merge 36 commits into6.xfrom
Closed
[6.x] Driver based image manipulation with render tag#10204jasonvarga wants to merge 36 commits into6.xfrom
jasonvarga wants to merge 36 commits into6.xfrom
Conversation
…asically copy pasted)
Dedicated classes to represent sources now replace - awkward string|Asset union types - SourceType enum. the class itself is the identifier of the type. All source classes can return an asset. - For external urls, they will be null - For assets obviously the asset - For asset ids it will resolve the asset by id - For paths it will attempt to resolve by url from the root. This happens for the existing implementation. Render tag: - The driver method accepts the raw source and converts it to the class. - Uses the new source ahead of time to resolve the focal point when using fit="crop_focal"
Contributor
|
Would this be something in the future where Statamic itself would support a certain number of popular image providers by default? Or would they all be addon based? Just curious because we use Cloudflare images as our image provider. |
Member
Author
|
Cloudflare images is probably a good one to also support natively. |
# Conflicts: # src/Facades/Glide.php # src/Http/Controllers/CP/Assets/ThumbnailController.php # src/Imaging/ImageGenerator.php
Adding focal point params is upcoming and this will make it consistent and clearer that we don't want to override the entire the entire array of params.
This was referenced Sep 30, 2024
Member
Author
|
More than likely this stale PR will be discarded in favor of something built using laravel/framework#59276 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
This is very much a work in progress.
Currently, all image manipulation is fairly tightly integrated with Glide.
This PR introduces the concept of driver-based image manipulation. Glide will continue to ship as the default, but it will become easier to swap it out for other services such as Imgix, Cloudinary, Cloudflare Images, etc.
This will also introduce a new
rendertag which will be essentially identical to theglidetag but allow you to use any driver. For example, if you were to use the imgix driver, you'd be able to use their face detection and background removal features:{{ render:image w="100" h="200" fit="facearea" faceindex="1" facepad="2" bg-remove="true" }}This is aimed to be introduced in the 5.x line at some point, so everything should be backwards compatible. You will be able to opt into it by either using the new
rendertag, or by customizing your image manipulation config file.?p=whateveras a param, it would unpack them and do?w=100&h=100&etc=width=>w)fit="crop_focal"param only works for glide. Needs to be smarter. e.g. glide wants?fit=crop-1-1-1but imgix wants something like?fit=crop&crop=focalpoint&fp-x=1&fp-y=1&fp-z=1