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

Enable cropping via dynamic size array #46

Open
roborourke opened this issue Oct 17, 2019 · 0 comments
Open

Enable cropping via dynamic size array #46

roborourke opened this issue Oct 17, 2019 · 0 comments

Comments

@roborourke
Copy link
Contributor

In WP when you call wp_get_attachment_image_src() for example you pass in an array for the size parameter rather than a size name, in a Tachyon context this works great. There is however a limitation in WP that you cannot specify if the image should be cropped to the dimensions or not because all it does under the hood is find the nearest actual size or set width & height attributes on an image tag.

In Tachyon we can allow for overloading this size array with a 3rd item for cropping eg:

$src = wp_get_attachment_image_src( $id, [ 300, 200, true ] );

This won't break any core code as it just references $size[0] and $size[1] directly but allows us to access $size[2] and choose whether to apply resize or fit in the tachyon URL.

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

No branches or pull requests

1 participant