Il y a actuellement 55 visiteur(s) et 0 membre(s) en ligne.
Devenez membre privilégié en cliquant ici
Pages vues depuis 20/04/2015 : 20 929 648
Hi Describe the bug Since v8 ? tested with 8.2 To Reproduce Steps to reproduce the behavior: Go to '(https://openlayers.org/en/latest/examples/ful…
Hi Describe the bug Since v8 ? tested with 8.2 To Reproduce Steps to reproduce the behavior: Go to '...' (it is just for example ...my site is aff…
Hi if i go here (https://github.com/openlayers/openlayers/releases/download/v8.1.0/v8.1.0-package.zip) i get a folder named v8 should not be v8.1 o…
Index du forum »» Road map développement »» [Résolu] - publication d'image format src data:image
#autodoc dataimagetofile!!!!url(!!!!$base_64_string, $output_path) : Analyse la chaine $base_64_string pour touver "src data:image" SI oui : fabrication de fichiers (gif | png | jpeg) (avec $output_path) et remplacement de "src data:image" par "src url" et retourne $base_64_string modifié ou pas
function dataimagetofile!!!!url(!!!!$base_64_string, $output_path) {
$rechdataimage = '#src=\\\"(data:image/[^"]+)\\\"#m';
preg_match_all($rechdataimage, $base_64_string, $dataimages);
$j=0;
foreach($dataimages[1] as $imagedata) {
$datatodecode = explode(',',$imagedata);
$bin = base_64_decode($datatodecode[1]);
$im = imageCreateFromString($bin);
if (!$im)
die('Image non valide');
$size = getImageSizeFromString($bin);
$ext = substr($size['mime'], 6);
if (!in_array($ext, ['png', 'gif', 'jpeg']))
die('Image non supportée');
$output_file = $output_path."_".$j."_".time().".".$ext;
$base_64_string = preg_replace($rechdataimage, 'src="'.$output_file.'"', $base_64_string,1);
$args = [$im, $output_file];
if ($ext == 'png')
$args[] = 0;
else if ($ext == 'jpeg')
$args[] = 100;
$fonc = "image{$ext}";
call_user_func_array($fonc, $args);
$j++;
}
return $base_64_string;
}
$story = dataimagetofile!!!!url(!!!!$story,'modules/upload/upload/artin');
$bodytext = dataimagetofile!!!!url(!!!!$bodytext,'modules/upload/upload/artco'');