Colleagues.
I have a system where I created an upload method:
public function gerarThumb($foto){
$diretorioNormal = "../../produtos/";
$novaLargura = 997;
$novaAltura = 665;
$miniatura = imagecreatetruecolor($novaLargura, $novaAltura);
$imagem = imagecreatefromjpeg($foto);
imagecopyresampled($miniatura, $imagem, 0, 0, 0, 0, $novaLargura, $novaAltura, $largura, $altura);
imagejpeg($miniatura,$diretorioNormal.$foto,90);
return $foto;
} // Fim do método gerarThumb
So far so good, all right, but if a person does not take the photo horizontally, it stretches. An example:
I would like to know if you have how to adjust photos, regardless of whether the photo is horizontal or vertical, but keeping them all the same height and width, even if you create white borders on the side in case the image is vertical.