dongqing5925 2019-07-31 13:21
浏览 176

PHP base64转换为jpg文件很大

I open one file with 70kb :

$img = 'data:image/jpg;base64,'.base64_encode(file_get_contents($img));

If I save this code via below code, image saved with 1.5mb size!

$file = fopen('new.jpg', "wb");
$data = explode(',', $img);
fwrite($file, base64_decode($data[1]));
fclose($file);

How I can fix it?

  • 写回答

0条回答 默认 最新

    报告相同问题?