media_upload_nextgen

The NextCellent Gallery media upload nextgen function.

Description

media_upload_nextgen(); 

Usage

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

Defined (1)

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

/admin/media-upload.php  
  1. function media_upload_nextgen() { 
  2.  
  3. // Not in use 
  4. $errors = false; 
  5.  
  6. // Generate TinyMCE HTML output 
  7. if ( isset($_POST['send']) ) { 
  8. $keys = array_keys($_POST['send']); 
  9. $send_id = (int) array_shift($keys); 
  10. $image = $_POST['image'][$send_id]; 
  11. $alttext = stripslashes( htmlspecialchars ($image['alttext'], ENT_QUOTES)); 
  12. $description = stripslashes (htmlspecialchars($image['description'], ENT_QUOTES)); 
  13.  
  14. // here is no new line allowed 
  15. $clean_description = preg_replace("/\n|\r\n|\r$/", " ", $description); 
  16. $img = nggdb::find_image($send_id); 
  17. $thumbcode = $img->get_thumbcode(); 
  18. $class="ngg-singlepic ngg-{$image['align']}"; 
  19.  
  20. // Build output 
  21. if ($image['size'] == "thumbnail")  
  22. $html = "<img src='{$image['thumb']}' alt='$alttext' class='$class' />"; 
  23. // Wrap the link to the fullsize image around  
  24. $html = "<a $thumbcode href='{$image['url']}' title='$clean_description'>$html</a>"; 
  25.  
  26. if ($image['size'] == "full")  
  27. $html = "<img src='{$image['url']}' alt='$alttext' class='$class' />"; 
  28.  
  29. if ($image['size'] == "singlepic")  
  30. $html = "[singlepic id=$send_id w=320 h=240 float={$image['align']}]"; 
  31.  
  32.  
  33. // Return it to TinyMCE 
  34. return media_send_to_editor($html); 
  35.  
  36. // Save button 
  37. if ( isset($_POST['save']) ) { 
  38.  
  39. return wp_iframe( 'media_upload_nextgen_form', $errors );