public static function base64EncodeImage ($image_file) {
$base64_image = '';
$image_info = getimagesize($image_file);
$image_data = file_get_contents($image_file);
$base64_image = 'data:' . $image_info['mime'] . ';base64,' . base64_encode($image_data);
return $base64_image;
}
图片
地图
base64
PHP