Skip to content

Commit

Permalink
Removed memory limit filter on Marko's advice
Browse files Browse the repository at this point in the history
  • Loading branch information
roborourke committed Mar 19, 2013
1 parent 6b25b04 commit 1e394bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
18 changes: 3 additions & 15 deletions editor/image-editor-gd-face-detect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}


Expand All @@ -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}" );

Expand Down Expand Up @@ -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;
}

}
3 changes: 3 additions & 0 deletions face-detect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) )
Expand Down

0 comments on commit 1e394bd

Please sign in to comment.