Cita:
la imagen la recivo en un input tipe hidden por medio de javascript y le ago un submit al formulario como ago que este valor que se recibe en base64 lo pueda guardar en una bd <?php
$con=mysql_connect('localhost','root','525');
mysql_select_db("imagenes",$con);
/************************************/
if(isset($_POST['x']) && !empty($_POST['x'])){
$file=base64_decode($_POST['x']);
//$file =str_replace(' ','+',$file);
$imagenEscapes=mysql_real_escape_string(file_get_c ontents($file));
$result=mysql_query("INSERT INTO `base64`VALUES (null,'".$file."')",$con);
/*con esta linea de codigo ago que se me descarge en la carpeta descargas de mi pc
$ctype="image/png";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"image.png\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($file))/1024;
echo $file;
exit;*/
}
?>
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
canvas {
border: 1px solid #9C9898;
}
</style>
<script src="kinetic-v4.0.2.js"></script>
<script src="canvas.js"></script>
</head>
<body>
<div id="container"></div>
<img src="images/hair.png" id="hair"></img>
<img src="images/head.png" id="head"></img>
<img src="images/leftArm.png" id="leftArm"></img>
<img src="images/legs.png" id="legs"></img>
<img src="images/rightArm.png" id="rightArm"></img>
<img src="images/torso.png" id="torso"></img><br>
<img src="images/hair1.png" id="hair1"></img>
<img src="images/head1.png" id="head1"></img>
<img src="images/leftArm1.png" id="leftArm1"></img>
<img src="images/legs1.png" id="legs1"></img>
<img src="images/rightArm1.png" id="rightArm1"></img>
<img src="images/torso1.png" id="torso1"></img>
<form ENCTYPE="multipart/form-data" id="f1" action="index.php" method="post">
<input name="x" id="x" type="hidden">
<input type="button" id="save" value="guardar">
</form>
</body>
</html>
$con=mysql_connect('localhost','root','525');
mysql_select_db("imagenes",$con);
/************************************/
if(isset($_POST['x']) && !empty($_POST['x'])){
$file=base64_decode($_POST['x']);
//$file =str_replace(' ','+',$file);
$imagenEscapes=mysql_real_escape_string(file_get_c ontents($file));
$result=mysql_query("INSERT INTO `base64`VALUES (null,'".$file."')",$con);
/*con esta linea de codigo ago que se me descarge en la carpeta descargas de mi pc
$ctype="image/png";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"image.png\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($file))/1024;
echo $file;
exit;*/
}
?>
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
canvas {
border: 1px solid #9C9898;
}
</style>
<script src="kinetic-v4.0.2.js"></script>
<script src="canvas.js"></script>
</head>
<body>
<div id="container"></div>
<img src="images/hair.png" id="hair"></img>
<img src="images/head.png" id="head"></img>
<img src="images/leftArm.png" id="leftArm"></img>
<img src="images/legs.png" id="legs"></img>
<img src="images/rightArm.png" id="rightArm"></img>
<img src="images/torso.png" id="torso"></img><br>
<img src="images/hair1.png" id="hair1"></img>
<img src="images/head1.png" id="head1"></img>
<img src="images/leftArm1.png" id="leftArm1"></img>
<img src="images/legs1.png" id="legs1"></img>
<img src="images/rightArm1.png" id="rightArm1"></img>
<img src="images/torso1.png" id="torso1"></img>
<form ENCTYPE="multipart/form-data" id="f1" action="index.php" method="post">
<input name="x" id="x" type="hidden">
<input type="button" id="save" value="guardar">
</form>
</body>
</html>