您好,登錄后才能下訂單哦!
function base64_img($base64_img){
/* $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 );
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。