-
Notifications
You must be signed in to change notification settings - Fork 40
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
rdebeasi
wants to merge
15
commits into
tomaszsita:master
Choose a base branch
from
statnews:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
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.
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.
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).