【发布时间】:2014-06-21 19:56:49
【问题描述】:
我有一个用 base64 字符串编码的图像,我需要将它作为图像保存在文件夹中。 这是代码:
$img = Input::get('myField');
define('UPLOAD_DIR', 'C:/wamp/www/laravel/dentalRoyale/public/assets/profile/');
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
是的,它保存在配置文件文件夹中。但我无法打开我急需的图像。我怎样才能解决这个问题?谢谢
【问题讨论】:
-
“打不开”是什么意思?你想做什么?