2
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 horizontal photo, it is stretched. An example:
I wonder if you have how to adjust the photos, regardless of whether the photo is horizontal or vertical, but keeping all the same height and width, even if you create white borders next door in case the image is vertical.