/** 把网络图片图片转成base64
* @param string $img ?图片地址
* @return string
*/
/*网络图片转为base64编码*/
function imgtobase64($img=‘‘, $imgHtmlCode=true)
{
??????$imageInfo = getimagesize($img);
??????$base64 = "" . chunk_split(base64_encode(file_get_contents($img)));
??????return ‘data:‘ . $imageInfo[‘mime‘] . ‘;base64,‘ . chunk_split(base64_encode(file_get_contents($img)));;
}
php把网络图片转Base64编码。
原文地址:https://www.cnblogs.com/yyhhblog/p/10084163.html