save Base64 Encoded...
Scris: Lun Oct 29, 2012 12:56 pm
salut...am generat un grafic pe care il citesc folosind <img src="simpleplot.php"/>, vreau sa preiau imaginea si sa o transform in png ca tre sa fac export in pdf la graficul generat.
am incercat cu base64_decode imi genereaza png dar imi spune no preview available...
<?php
define('UPLOAD_DIR', 'images/');
$img = 'plot.php';
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$fisier = file_put_contents($file, $data);
print $fisier ? $file : 'Unable to save the file.';
?>
multumesc...
am incercat cu base64_decode imi genereaza png dar imi spune no preview available...
<?php
define('UPLOAD_DIR', 'images/');
$img = 'plot.php';
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$fisier = file_put_contents($file, $data);
print $fisier ? $file : 'Unable to save the file.';
?>
multumesc...