How can I strip the data:image part from a base64 string of any image type in PHP

前端 未结 5 967
借酒劲吻你
借酒劲吻你 2021-01-04 18:29

I am currently doing the following to decode base64 images in PHP:

   $img = str_replace(\'data:image/jpeg;base64,\', \'\', $s[\'image\']);
   $img = str_rep         


        
5条回答
  •  甜味超标
    2021-01-04 19:14

    You can Regular expression for remove image or pdf data formate.

    data.replace(/^data:application\/[a-z]+;base64,/, "")
    

提交回复
热议问题