/** 把网络图片图片转成base64
     * @param string $img 图片地址
     * @return string
     */
    /*网络图片转为base64编码*/
    public 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编码。(php将图片链接直接转化为base64编码)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-06-05
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-09-23
  • 2021-06-05
  • 2022-12-23
相关资源
相似解决方案