file_save

The Responsive Minimal file save function.

Description

file_save( (string) $filename, $slider_info, $upload_dir, $return_html ); 

Parameters (4)

0. $filename (string)
The filename.
1. $slider_info
The slider info.
2. $upload_dir
The upload dir.
3. $return_html
The return html.

Usage

  1. if ( !function_exists( 'file_save' ) ) { 
  2. require_once '/functions/slider_images.php'; 
  3.  
  4. // The filename. 
  5. $filename = ''; 
  6.  
  7. // The slider info. 
  8. $slider_info = null; 
  9.  
  10. // The upload dir. 
  11. $upload_dir = null; 
  12.  
  13. // The return html. 
  14. $return_html = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = file_save($filename, $slider_info, $upload_dir, $return_html); 
  18.  

Defined (1)

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

/functions/slider_images.php  
  1. function file_save($filename, $slider_info, $upload_dir, $return_html) { 
  2. $img_dimensions=maybe_unserialize(get_option('themeshock_slider_dimensions'));//carga las imagenes  
  3. ob_clean(); 
  4. session_start(); 
  5. //var_dump($_SESSION['sld_info']); 
  6. $index=count($slider_info); 
  7. $slider_info[$index]['active']=true; 
  8. $slider_info[$index]['link']='#'; 
  9. $slider_info[$index]['url']=$upload_dir['baseurl'].'/slider/'.$filename; 
  10. $slider_info[$index]['path']=$upload_dir['basedir'].'/slider/'.$filename; 
  11. createthumb($slider_info[$index]['path'], $slider_info[$index]['path'], $img_dimensions[0], $img_dimensions[1]); 
  12. $slider_info[$index]['thumbnail']=$upload_dir['baseurl'].'/slider/'.basename(image_resize($slider_info[$index]['path'], 200, 200)); 
  13. ?> 
  14. <span class="number"><?php echo $index+1; ?></span> 
  15. <img class="thumb" src="<?php echo $slider_info[$index]['thumbnail']?>" /> 
  16. <input type="text" name="file_<?php echo $index; ?>" value="<?php echo $slider_info[$index]['link'];?>" /> 
  17. <input type="button" value="save link" data-id="<?php echo $index; ?>" />  
  18. <input type="button" value="^" data-value="up" data-id="<?php echo $index; ?>" /><input type="button" data-value="down" value="v" data-id="<?php echo $index; ?>" /> 
  19. <img class="close" src="<?php echo get_template_directory_uri(); ?>/img/close.png" data-id="<?php echo $index; ?>" /> 
  20. <input type="checkbox" value="true" data-value="sld_image" <?php echo ($slider_info['active'])?'checked="checked"':'';?> data-id="<?php echo $index; ?>" /> 
  21. <?php 
  22. update_option('themeshock_slider_images', maybe_serialize($slider_info)); 
  23. $html=ob_get_clean(); 
  24. if ($return_html==true) { 
  25. echo json_encode(array('success'=>true/**, 'html'=>$html*/)); 
  26. else{ 
  27. echo json_encode(array('success'=>true));