0
我们使用PHP curl将图像保存到数据库。我们从xml中获取图像的地址。录制完图像后,我们遇到以下问题。图像叠加,它们被错误地记录。或者图像以名称保存为空白图像。使用PHP curl获取/保存图像
function resim($link, $klasor, $dosya)
{
if (!file_exists($klasor)) {
mkdir($klasor);
}
$type = strtolower(substr(strrchr($link,"."),1));
if ($type == 'jpeg') {
$type = 'jpg';
}
$resim = fopen("{$klasor}/{$dosya}.{$type}", 'w');
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_FILE, $resim);
curl_exec($ch);
curl_close($ch);
fclose($resim);
}
- 我们在哪里犯错?或者我们可以用另一种方式做到吗?
- 我们如何获得图像完成信息?
我们的尊重。
感谢Alaa Attia Mohamed。我们将对文件格式加以限制。最好的祝福。 –