2015-10-17 181 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