企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
``` ~~~ /** * @param string $img * @param bool $imgHtmlCode * @return string * @describe:img to 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))); } ~~~ ```