Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Don't include editors #2

markoheijnen opened this Issue · 5 comments

2 participants


Awesome stuff what you did with the code I build. When I saw the face detection I was planning the same. Didn't looked yet really good to the code but you shouldn't include image editor classes.

WP_Image_Editor_GD_Detect_Face needs it's own file and that should be included inside the wp_image_editors filter. See the code for the Gmagick plugin:


It was a fairly short file so I didn't bother splitting it out yet, just wanted to get it working! Also
I am already adding the class by using the wp_image_editors filter - see the main plugin class at the top of the file :) Awesome work on that, I was really happy to discover it!

Unfortunately it's a bit too slow to use in production yet as I haven't found a good way to give the user feedback that it's detecting faces with the new media library code. There's a javascript event that fires when the upload starts and after the resizing is done but not when file is uploaded and before resizing begins as far as I could tell.

Ideally I should write a plugin that uses the actual openCV extension.

If you have any other tips for improvement I'd love to hear them!


There is always the change of possible breakages.

Currently playing with an image editor in Backbone and was thinking about integrating something like this.
I think a feature like this should be done on user input. If I always upload nature images it doesn't make that much sense.


I absolutely agree. Will see if I can add in a checkbox on the upload dialog that sets an option.

What's the best place to increase the max execution time for image resizing?


WordPress doesn't have a feature for that so set_time_limit(30) would do and in this case it should be inside WP_Image_Editor_GD_Detect_Face ::face_crop()


Fixed this now - sorry I didn't see what you meant at first by not including the main editor files. I have a habit of not putting includes/requires inside functions but in this case obviously it makes sense!

Thanks for the advice and the example :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.