function base64_img($base64_img){
創(chuàng)新互聯(lián)公司為您提適合企業(yè)的網(wǎng)站設(shè)計?讓您的網(wǎng)站在搜索引擎具有高度排名,讓您的網(wǎng)站具備超強的網(wǎng)絡(luò)競爭力!結(jié)合企業(yè)自身,進行網(wǎng)站設(shè)計及把握,最后結(jié)合企業(yè)文化和具體宗旨等,才能創(chuàng)作出一份性化解決方案。從網(wǎng)站策劃到成都做網(wǎng)站、網(wǎng)站制作, 我們的網(wǎng)頁設(shè)計師為您提供的解決方案。
/* $base64_string = $base64_img;
$savename = uniqid().'.jpeg';
$save_path = $php_path . 'Uploads/';
$ymd = date("Ymd");
$save_path .= $ymd . "/";
$save_url .= $ymd . "/";
if (!file_exists($save_path)) {
mkdir($save_path);
}
$savepath = $save_path . $savename;
$image = base64_to_img( $base64_string, $savepath );
return '/'.$image; */
$base64_string = $base64_img;
$base64_0=explode(',', $base64_string);
$base64_1=explode('/', $base64_0['0']);
$base64_2=explode(';', $base64_1['1']);
$s = base64_decode(str_replace(''.$base64_0['0'].',','',$base64_string));
$savename = uniqid().time().rand(10000,99999).'.'.$base64_2['0'];
$save_path = $php_path . 'Uploads/image/';
$ymd = date("Ymd");
$save_path .= $ymd . "/";
$save_url .= $ymd . "/";
if (!file_exists($save_path)) {
mkdir($save_path);
}
$savepath = $save_path . $savename;
$image= file_put_contents($savepath, $s);
return '/'.$savepath;
}
function base64_to_img( $base64_string, $output_file ) {
$ifp = fopen( $output_file, "wb" );
fwrite( $ifp, base64_decode( $base64_string) );
fclose( $ifp );
return( $output_file );
}