true,'html'=>'logo','logo_url'=>$GLOBALS['logo_info']['url']));
}
function file_save($filename,$slider_info,$upload_dir,$return_html){
$img_dimensions=maybe_unserialize(get_option('themeshock_slider_dimensions'));//carga las imagenes
ob_clean();
session_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;
createthumb($slider_info[$index]['path'],$slider_info[$index]['path'],$img_dimensions[0],$img_dimensions[1]);
$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);
}
?>