2015-10-17 118 views
0

使用php获取裁剪img src(使用ngImgCrop制作)更好的方法是什么?ngImgCrop使用php获取src

它给我带回一个base64 IMG ..

的图像是类似的东西:

<img ng-src="data:image/png;base64;................"/> 

我tryed是这样的:

function base64_to_jpeg($base64_string, $output_file) { 

    $ifp = fopen($output_file, "wb"); 

    $data = explode(',', $base64_string); 

    fwrite($ifp, base64_decode($data[1])); 
    fclose($ifp); 

    return $output_file; 

} 

回答

0

您需要删除领先“data:image/png; base64”,然后对代表新图像的字符串执行base64_decode