Colleagues
I'm adjusting a system where some images already exist in a certain directory, the thumbnail handling of the files was not done and the images were taking a while to open, since they are using the bootstrap thumbnail.
<img src=\"produtos/".$foto."\" data-imagezoom=\"true\" class=\"img-responsive thumb-image\">
To reduce the impact, I created a method where I decrease the image with php:
public function gerarThumb($foto){
list($largura,$altura) = getimagesize($foto);
$novaLargura = 300;
$novaAltura = 300;
$miniatura = imagecreatetruecolor($novaLargura, $novaAltura);
$imagem = imagecreatefromjpeg($foto);
imagecopyresampled($miniatura, $imagem, 0, 0, 0, 0, $novaLargura,
$novaAltura, $largura, $altura);
imagejpeg($miniatura,$foto,50); // Já coloquei 100 e não funcionou
return $foto;
}
I was able to decrease the image, but the quality is very poor. Check out one of the photos:
The photos are jpg and png. How could I improve the quality of the images?