eu tenho este script que da upload na imagem e cria imagem thumbs
ate ai tudo beleza as imagem são gravada nos diretorios
o que eu estou querendo e que as mesmas imagem foce para um db
este e o script
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title></title>
</head>
<body >
<?
// Below lines are to display file name, temp name and file type , you can use them for testing your script only//////
echo "Arquivo nome: ".$_FILES[userfile][name]."<br>";
echo "link nome: ".$_FILES[userfile][tmp_name]."<br>";
echo "Arquivo tipo: ".$_FILES[userfile][type]."<br>";
echo "<br><br>";
///////////////////////////////////////////////////////////////////////////
$add="upimg/".$_FILES[userfile][name]; // the path with the file name where the file will be stored, upload is the directory name.
//echo $add;
if(move_uploaded_file ($_FILES[userfile][tmp_name],$add)){
echo "Carregado com sucesso";
chmod("$add",0777);
}else{echo "Falha ao carregar arquivo";
exit;}
///////// Start the thumbnail generation//////////////
$n_width=100; // Fix the width of the thumb nail images
$n_height=100; // Fix the height of the thumb nail imaage
$tsrc="thimg/".$_FILES[userfile][name]; // Path where thumb nail image will be stored
//echo $tsrc;
if (!($_FILES[userfile][type] =="image/pjpeg" OR $_FILES[userfile][type]=="image/gif")){echo "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>";
exit;}
/////////////////////////////////////////////// Starting of GIF thumb nail creation///////////
if (@$_FILES[userfile][type]=="image/gif")
{
$im=ImageCreateFromGIF($add);
$width=ImageSx($im); // Original picture width is stored
$height=ImageSy($im); // Original picture height is stored
$newimage=imagecreatetruecolor($n_width,$n_height);
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
if (function_exists("imagegif")) {
Header("Content-type: image/gif");
ImageGIF($newimage,$tsrc);
}
elseif (function_exists("imagejpeg")) {
Header("Content-type: image/jpeg");
ImageJPEG($newimage,$tsrc);
}
chmod("$tsrc",0777);
}////////// end of gif file thumb nail creation//////////
////////////// starting of JPG thumb nail creation//////////
if($_FILES[userfile][type]=="image/pjpeg"){
$im=ImageCreateFromJPEG($add);
$width=ImageSx($im); // Original picture width is stored
$height=ImageSy($im); // Original picture height is stored
$newimage=imagecreatetruecolor($n_width,$n_height);
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
ImageJpeg($newimage,$tsrc);
chmod("$tsrc",0777);
}
//////////////// End of JPG thumb nail creation //////////
?>
<center><a HREF="addimg.php">Enviar mais imagem</a></center>
</body>
</html>
e esta seria a tabela que eu gostara que ela foce salva
Question
arldin
Bom dia a todos
eu tenho este script que da upload na imagem e cria imagem thumbs
ate ai tudo beleza as imagem são gravada nos diretorios
o que eu estou querendo e que as mesmas imagem foce para um db
este e o script
e esta seria a tabela que eu gostara que ela foce salva
CREATE TABLE `tbl_imagens` (
`id_imagem` int(11) NOT NULL auto_increment,
`imagem_grd` varchar(150) NOT NULL default,
`imagem_thumb` varchar(150) NOT NULL default,
`status` varchar(10) NOT NULL default,
PRIMARY KEY (`id_imagem`)
);
agradeço a todos pela força
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.