Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed memory limit filter on Marko's advice

  • Loading branch information...
commit 1e394bdf27ce4cc1e383aae48b39b9e934c09719 1 parent 6b25b04
@sanchothefat sanchothefat authored
Showing with 6 additions and 15 deletions.
  1. +3 −15 editor/image-editor-gd-face-detect.php
  2. +3 −0  face-detect.php
View
18 editor/image-editor-gd-face-detect.php
@@ -14,9 +14,6 @@ public function __construct( $file ) {
// edit dims
add_filter( 'image_resize_dimensions', array( $this, 'face_crop' ), 10, 6 );
-
- // memory usage is high
- add_filter( 'image_memory_limit', array( $this, 'image_memory_limit' ), 10, 1 );
}
@@ -40,6 +37,9 @@ public function face_crop( $output, $orig_w, $orig_h, $dest_w, $dest_h, $crop )
// detect face
if ( $this->faces === null ) {
+ // time consuming - 30s not long enough :(
+ @set_time_limit( 60 );
+
// prepare face detector
$this->fd = new Face_Detector( FACE_DETECT_PATH . "php-facedetection/{$this->fd_file}" );
@@ -116,16 +116,4 @@ public function face_crop( $output, $orig_w, $orig_h, $dest_w, $dest_h, $crop )
return null;
}
- /**
- * Increase the max timeout and double check memory limit
- *
- * @param string $limit The maximum memory limit allowed by PHP
- *
- * @return string
- */
- public function image_memory_limit( $limit ) {
- @set_time_limit( 60 );
- return $limit;
- }
-
}
View
3  face-detect.php
@@ -6,6 +6,9 @@
Author: Robert O'Rourke @ interconnect/it
Version: 0.1
Author URI: http://interconnectit.com
+
+Thanks to Marko Heijnen for feedback
+https://github.com/markoheijnen
*/
if ( ! defined( 'FACE_DETECT_PATH' ) )
Please sign in to comment.
Something went wrong with that request. Please try again.