Follow the code, then the question.
$localDiretorioFoto = "img/mensagens/";
$img = $_FILES["foto"]["tmp_name"];
$imgg = getimagesize($img);
if($imgg["mime"] == "image/jpeg") {
$nomeFoto = imagecreatefromjpeg($img);
} else if($imgg["mime"] == "image/png") {
$nomeFoto = imagecreatefrompng($img);
}
imagejpeg($nomeFoto, $localDiretorioFoto, 50);
I'm trying to save an image, and I'm saving the $ filename in bd, but what it saves is: Resource id # 4 and the image is not saved in the img / / Why?
Should I use header and / or imagedestroy? If so, why?