[英]ngImgCrop get src with php
what s the better way to get cropped img src (made with ngImgCrop) with php? 用php裁剪img src(由ngImgCrop制造)的更好方法是什么?
It give me back a base64 img.. 它给了我一个base64 img。
The image is something like that: 图像是这样的:
<img ng-src="data:image/png;base64;................"/>
I tryed something like this: 我尝试过这样的事情:
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;
}
您需要先删除开头的“ data:image / png; base64”,然后再对代表新图像的字符串执行base64_decode
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.