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

Add filters and actions #46

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Add filters and actions #46

wants to merge 15 commits into from

Conversation

rdebeasi
Copy link

@rdebeasi rdebeasi commented Dec 1, 2015

I've added a few filters to the plugin so that other plugins can interact with it. I think this should address the request in #37. @firejdl has added an action that runs when the crop is done. This change solves issue #25.

My text editor also removed some space at the ends of lines, for some reason.

Anyway, I'd love to hear your thoughts! Feel free to let me know if you'd like to see any changes or if this can be merged as-is. Manual Image Crop rocks - thanks so much for developing it!

filters

mic_do_crop

Provides $do_crop (bool), $metadata (array), and $dims (array). Returning false for $do_crop will prevent Manual Image Crop from cropping the image. $metadata contains the crop parameters, so another plugin can take over the actual cropping.

mic_dst_file_path

Provides $path (string) and $data (array). Manual Image Crop will write the new image to $path and save that path to the image metadata. $data contains the crop parameters that the user chose in WordPress admin.

mic_dst_file_url

Provides $url (string) and $data (array). Manual Image Crop will return $url in an AJAX response if the image crop is successful. $data contains the crop parameters that the user chose in WordPress admin.

actions

mic_crop_done

Triggered after a crop has been successfully completed, immediately before the JSON response is sent to the browser. Provides $data (array) and $imageMetadata (array).

rdebeasi and others added 13 commits December 1, 2015 11:49
The plugin now has filters for destination file path, destination file URL, and $do_crop. These filters can be used by other plugins. (If $do_crop is false, manual image crop will save metadata but leave the actual resizing to another plugin.)
Run an action that other scripts can hook into, letting them know
that the cropping is done for the given image
…the changes are back in the mainline version of the plugin.
@rdebeasi rdebeasi changed the title Add filters Add filters and actions Dec 16, 2015
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.

2 participants