-
Notifications
You must be signed in to change notification settings - Fork 200
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
Circle manipulator #104
Circle manipulator #104
Conversation
Decided against this? |
I was going to suggest that this might be better done with border-radius. Less problematic, and border-radius is widely supported now. |
@reinink I've made something similar but also support for the following shapes:
The last 4 options are drawn with the polygon option. Source can be found here: https://gist.github.com/kleisauke/26a4f9d31469e9c0470b Example output if we are using this image (?w=500&star): Let me know if this is applicable for Glide and whether it is worth a pull request. |
@kleisauke Hey, thanks for sharing this! Just curious, what sort of applications have you used this? This is pretty cool, don't get me wrong, I just wonder how realistic it is that someone would actually use this feature. |
@reinink We intend to use this in the future for our image cache & resize proxy. I'm also not sure if someone actually would use this feature, but it's worth a try. |
@kleisauke Hello! This is exactly what I need for my project... don't want to use border-radius.. want to pre-transform into a shape and cache the image Unfortunately I see your gist is no longer available. I took a quick look at your project and found this class https://github.com/andrieslouw/imagesweserv/blob/3.x/src/Manipulators/Shape.php which seems to be related, but it's not clear whether you make use of Glide at all and I don't know how to implement this with Glide. Any chance you could restore the gist? Or provide a hint as to how to implement your new class with Glide please? Many thanks! |
@vesper8 Here you can find the shape manipulator that should be compatible with Glide: From version 3.x we dropped Intervention Image in favor of php-vips because resizing an image with libvips is typically 4x-5x faster than using the quickest ImageMagick. |
@kleisauke Thanks for taking the time! Would you mind also telling me how I can use this custom manipulator? I've tried finding out more about custom manipulators in the Glide docs and issues and this issue is actually one of the only things that comes up.. there's like no help that I could find.. would really save me some time if you could write a few more lines on the subject :) thanks! |
@vesper8 I've created an example project with a custom Glide manipulator, see the attachment.
composer install
Attachment: Example project as zip file. |
I needed to draw circles the same way you would use border-radius with CSS. This commit adds the 'circle' parameter :)