$slider_info){?>
true,'html'=>'logo','logo_url'=>$GLOBALS['logo_info']['url']));
}
function file_save($filename,$slider_info,$upload_dir,$return_html){
$img_dimensions=get_option('themeshock_slider_dimensions');//carga las imagenes
ob_clean();
session_start();
ob_start();
//var_dump($_SESSION['sld_info']);
$index=count($slider_info);
$slider_info[$index]['active']=true;
$slider_info[$index]['link']='#';
$slider_info[$index]['url']=$upload_dir['baseurl'].'/slider/'.$filename;
$slider_info[$index]['path']=$upload_dir['basedir'].'/slider/'.$filename;
$sld_bs_p=$upload_dir['basedir'].'/slider/';
//createthumb($slider_info[$index]['path'],$slider_info[$index]['path'],$img_dimensions['sld_normal']['w'],$img_dimensions['sld_normal']['h']);
//$get_info_img=getimagesize($slider_info[$index]['path']);
// list($width_sld, $height_sld, $type, $attr) = getimagesize($slider_info[$index]['path']);
foreach ($img_dimensions as $img_type => $value){
switch ($img_type){
case 'sld_hd':
$slider_info[$index]['img_hd']=$upload_dir['baseurl'].'/slider/hd_'.basename($slider_info[$index]['path']);
$path_dst=$sld_bs_p.'hd_'.$filename;
break;
case 'sld_normal':
$slider_info[$index]['url']=$upload_dir['baseurl'].'/slider/md_'.basename($slider_info[$index]['path']);
$path_dst=$sld_bs_p.'md_'.$filename;
break;
case 'sld_th':
$slider_info[$index]['thumbnail']=$upload_dir['baseurl'].'/slider/th_'.basename($slider_info[$index]['path']);
$path_dst=$sld_bs_p.'th_'.$filename;
break;
}
$image = wp_get_image_editor( $slider_info[$index]['path']);
$image->resize( (int)$value['w'], (int)$value['h'],true);
$image->save( $path_dst );
}
// $slider_info[$index]['thumbnail']=$upload_dir['baseurl'].'/slider/'.basename(image_resize($slider_info[$index]['path'],200,200));
?>
data-id="" />
true/*,'html'=>$html*/));
}
else{
echo json_encode(array('success'=>true));
}
}
function createthumb($name,$filename,$new_w,$new_h)
{
$path_info=pathinfo($name);
switch($path_info['extension']){
case'gif':
$src_img=imagecreatefromgif($name);
break;
case'jpg':
case'jpeg':
$src_img=imagecreatefromjpeg($name);
break;
case'png':
$src_img=imagecreatefrompng($name);
break;
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
$thumb_w=$new_w;
$thumb_h=$new_h;
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
switch($path_info['extension']){
case'gif':
case'png':
// integer representation of the color black (rgb: 0,0,0)
// removing the black from the placeholder
imagecolortransparent($dst_img, imagecolorallocatealpha($dst_img, 0, 0, 0, 127));
// turning off alpha blending (to ensure alpha channel information
// is preserved, rather than removed (blending with the rest of the
// image in the form of black))
imagealphablending($dst_img, false);
// turning on alpha channel information saving (to ensure the full range
// of transparency dst_img preserved)
imagesavealpha($dst_img, true);
break;
}
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
switch($path_info['extension']){
case'gif':
imagegif($dst_img,$filename);
break;
case'jpg':
case'jpeg':
imagejpeg($dst_img,$filename);
break;
case'png':
imagepng($dst_img,$filename);
break;
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
?>