ngg_rotateImage

The NextGEN Gallery ngg rotateImage function.

Description

ngg_rotateImage(); 

Usage

  1. if ( !function_exists( 'ngg_rotateImage' ) ) { 
  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 = ngg_rotateImage(); 
  7.  

Defined (1)

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

/products/photocrati_nextgen/modules/ngglegacy/admin/ajax.php  
  1. function ngg_rotateImage() { 
  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. require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php'); 
  12.  
  13. // include the ngg function 
  14. include_once (dirname (__FILE__). '/functions.php'); 
  15.  
  16. $id = (int) $_POST['id']; 
  17. $result = '-1'; 
  18.  
  19. switch ( $_POST['ra'] ) { 
  20. case 'cw' : 
  21. $result = nggAdmin::rotate_image($id, 'CW'); 
  22. break; 
  23. case 'ccw' : 
  24. $result = nggAdmin::rotate_image($id, 'CCW'); 
  25. break; 
  26. case 'fv' : 
  27. // Note: H/V have been inverted here to make it more intuitive 
  28. $result = nggAdmin::rotate_image($id, 0, 'H'); 
  29. break; 
  30. case 'fh' : 
  31. // Note: H/V have been inverted here to make it more intuitive 
  32. $result = nggAdmin::rotate_image($id, 0, 'V'); 
  33. break; 
  34.  
  35. // recreate the thumbnail 
  36. nggAdmin::create_thumbnail($id); 
  37.  
  38. if ( $result == 1 ) 
  39. die('1'); 
  40.  
  41. header('HTTP/1.1 500 Internal Server Error'); 
  42. die( $result );