ngg_rotateImage

The NextCellent Gallery ngg rotateImage function.

Description

ngg_rotateImage(); 

Usage

  1. if ( !function_exists( 'ngg_rotateImage' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextcellent-gallery/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).

/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. $ngg_options = get_option(ngg_options); 
  17.  
  18. $id = (int) $_POST['id']; 
  19. $result = '-1'; 
  20.  
  21. switch ( $_POST['ra'] ) { 
  22. case 'cw' : 
  23. $result = nggAdmin::rotate_image($id, 'CW'); 
  24. break; 
  25. case 'ccw' : 
  26. $result = nggAdmin::rotate_image($id, 'CCW'); 
  27. break; 
  28. case 'fv' : 
  29. $result = nggAdmin::rotate_image($id, 0, 'V'); 
  30. break; 
  31. case 'fh' : 
  32. $result = nggAdmin::rotate_image($id, 0, 'H'); 
  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 ); 
  43.