Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Circle manipulator #104

wants to merge 3 commits into from

Conversation

pascalbaljet
Copy link
Contributor

I needed to draw circles the same way you would use border-radius with CSS. This commit adds the 'circle' parameter :)

@reinink
Copy link
Contributor

reinink commented Oct 23, 2015

Decided against this?

@reinink
Copy link
Contributor

reinink commented Oct 23, 2015

I was going to suggest that this might be better done with border-radius. Less problematic, and border-radius is widely supported now.

@kleisauke
Copy link

@reinink I've made something similar but also support for the following shapes:

  • Ellipse
  • Star (3, 4 and 5 point star)
  • Triangle
  • Square
  • Pentagon

The last 4 options are drawn with the polygon option.

Source can be found here: https://gist.github.com/kleisauke/26a4f9d31469e9c0470b
(Not yet finished because I think there are to many if else statements...)

Example output if we are using this image (?w=500&star):
Star example

Let me know if this is applicable for Glide and whether it is worth a pull request.

@reinink
Copy link
Contributor

reinink commented Jan 14, 2016

@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.

@kleisauke
Copy link

@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.

@vesper8
Copy link

vesper8 commented Jun 20, 2017

@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!

@kleisauke
Copy link

@vesper8 Here you can find the shape manipulator that should be compatible with Glide:
https://github.com/andrieslouw/imagesweserv/blob/78d8b32513eb630b57b0615977acc5464777630b/src/Manipulators/Shape.php

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.

@vesper8
Copy link

vesper8 commented Jun 23, 2017

@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!

@kleisauke
Copy link

@vesper8 I've created an example project with a custom Glide manipulator, see the attachment.

  1. Install dependencies with:
composer install
  1. Configure the server to redirect all requests to index.php (see glide.nginxconf for an example nginx config).

  2. Open localhost in your browser (or wherever you've hosted the website). You'll see something like this:
    shape-manipulator

Attachment: Example project as zip file.

custom-glide-manipulator.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants