media_upload_nextgen_save_image

The NextCellent Gallery media upload nextgen save image function.

Description

media_upload_nextgen_save_image(); 

Usage

  1. if ( !function_exists( 'media_upload_nextgen_save_image' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextcellent-gallery/admin/media-upload.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = media_upload_nextgen_save_image(); 
  7.  

Defined (1)

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

/admin/media-upload.php  
  1. function media_upload_nextgen_save_image() { 
  2.  
  3. global $wpdb; 
  4.  
  5. check_admin_referer('ngg-media-form'); 
  6.  
  7. if ( !empty($_POST['image']) ) foreach ( $_POST['image'] as $image_id => $image ) { 
  8.  
  9. // create a unique slug 
  10. $image_slug = nggdb::get_unique_slug( sanitize_title( $image['alttext'] ), 'image' );  
  11. $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggpictures SET image_slug= '%s', alttext= '%s', description = '%s' WHERE pid = %d", $image_slug, $image['alttext'], $image['description'], $image_id)); 
  12. wp_cache_delete($image_id, 'ngg_image');