createNewThumb

The NextGEN Gallery createNewThumb function.

Description

createNewThumb(); 

Usage

  1. if ( !function_exists( 'createNewThumb' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = createNewThumb(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/products/photocrati_nextgen/modules/ngglegacy/admin/ajax.php  
  1. function createNewThumb() { 
  2.  
  3. // check for correct capability 
  4. if ( !is_user_logged_in() ) 
  5. die('-1'); 
  6.  
  7. // check for correct NextGEN capability 
  8. if ( !current_user_can('NextGEN Manage gallery') ) 
  9. die('-1'); 
  10.  
  11. $id = (int) $_POST['id']; 
  12.  
  13. $x = round( $_POST['x'] * $_POST['rr'], 0); 
  14. $y = round( $_POST['y'] * $_POST['rr'], 0); 
  15. $w = round( $_POST['w'] * $_POST['rr'], 0); 
  16. $h = round( $_POST['h'] * $_POST['rr'], 0); 
  17. $crop_frame = array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h); 
  18.  
  19. $storage = C_Gallery_Storage::get_instance(); 
  20.  
  21. // XXX NextGEN Legacy wasn't handling watermarks or reflections at this stage, so we're forcefully disabling them to maintain compatibility 
  22. $params = array('watermark' => false, 'reflection' => false, 'crop' => true, 'crop_frame' => $crop_frame); 
  23. $result = $storage->generate_thumbnail($id, $params); 
  24.  
  25. if ($result) { 
  26. echo "OK"; 
  27. } else { 
  28. header('HTTP/1.1 500 Internal Server Error'); 
  29. echo "KO"; 
  30.  
  31. C_NextGEN_Bootstrap::shutdown();