A
Anonymous
Guest
i need to insert a tumb in a BLOB, this is my code
Code:
<?
include("conect.php");
$hoy = date("d")." de ".date("M")." del ".date("Y");
// here is created the tumb
$imagen_origen=ImageCreateFromJPEG($nombre);
$ancho=imagesx($imagen_origen);
$alto=imagesy($imagen_origen);
$tancho=$ancho;
$talto=$alto;
if ($alto == $ancho) {
$alto=100;
$ancho=100;
} else {
if ($alto > $ancho) {
$ancho = ($ancho * 100 / $alto);
$alto=100;
} else {
$alto = ($alto * 100 / $ancho);
$ancho=100;
}}
$imagen_destino=ImageCreateTrueColor($ancho, $alto);
imagecopyresized($imagen_destino, $imagen_origen, 0, 0, 0, 0, $ancho, $alto, $tancho, $talto);
// here i must do something to $imagen_destino i guess
mysql_query("insert into perras (fecha, tumb) values ('$hoy', '$imagen_destino')",$link);
$result = mysql_query("SELECT id FROM perras ORDER BY id DESC LIMIT 1", $link);
while ($myrow=mysql_fetch_array($result))
{
$ultimoid=$myrow["id"];
}
//ImageJPEG($imagen_destino,'',75);
// last tumb
$result = mysql_query("SELECT tumb FROM perras where id = $ultimoid", $link);
while ($myrow=mysql_fetch_array($result))
{
echo $myrow['tumb'];
}
echo "<br>";
echo $alto;
echo "<br>";
echo $ancho;
?>