update_slider_info

The Responsive Minimal update slider info function.

Description

update_slider_info(); 

Usage

  1. if ( !function_exists( 'update_slider_info' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = update_slider_info(); 
  7.  

Defined (1)

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

/functions.php  
  1. function update_slider_info() { 
  2. $upload_dir=wp_upload_dir(); 
  3. if (isset($upload_dir["error"]) && $upload_dir["error"]!==false ) { 
  4. $GLOBALS['error_folder']= 'The option to change logo and slider is disabled, please create the following folder: /wp-content/uploads/ and allow writing by setting its permissions to 0777'; 
  5. return false;  
  6. $directory_slider=$upload_dir['basedir']."/slider/"; 
  7. mkdir($directory_slider, 0777, true); 
  8. $directory_slider_base=get_template_directory()."/img/slider/{*.jpg, *.png, *.gif, *.bmp}"; 
  9. $img_directory_pack=glob($directory_slider_base, GLOB_BRACE); 
  10. $slider_info= array(); 
  11. foreach($img_directory_pack as $index => $img_slider_info) { 
  12. $get_info_img=getimagesize($img_slider_info); 
  13. $slider_info[$index]['active']=true; 
  14. $slider_info[$index]['link']='#'; 
  15. $slider_info[$index]['url']=$upload_dir['baseurl'].'/slider/'.basename($img_slider_info); 
  16. $slider_info[$index]['path']=$upload_dir['basedir'].'/slider/'.basename($img_slider_info); 
  17. //file_put_contents($slider_info[$index]['path'], file_get_contents($img_slider_info)); 
  18. check_filesystem($slider_info[$index]['path'], '', $img_slider_info, 'active-theme'); 
  19. @chmod($slider_info[$index]['path'], 0777); 
  20. $slider_info[$index]['thumbnail']=$upload_dir['baseurl'].'/slider/'.basename(image_resize($slider_info[$index]['path'], 200, 200)); 
  21. @chmod($slider_info[$index]['thumbnail'], 0777); 
  22. update_option('themeshock_slider_dimensions', maybe_serialize($get_info_img));/// guarda las dimenssiones de la imagen 
  23. update_option('themeshock_slider_images', maybe_serialize($slider_info));  
  24. $GLOBALS['slider_img_info']=$slider_info; 
  25. return $slider_info;