I'm using the following code to upload and resize some JPEG pictures to a web, the problem is that the resized pictures quality is too bad.
Is there any instruction for the gd or whatever to keep the quality as better as it is?? It seems like the compression ratio is increased, I would like it to keep it really low (0% should be excellent).
Code: Select all
$im1 = ImageCreateFromString($str);
$imgname = $Ref."thumb_1"; // Nombre imagen (se podría indicar desde el formulario)
$maxwidth = 300; // Ancho máximo
$maxheight = 150; // Alto máximo
$width1 = ImageSX($im1);
$height1 = ImageSY($im1);
$width2 = $maxwidth;
$height2 = floor(($width2 * $height1) / $width1);
if($maxheight > 0 && $height2 > $maxheight) {
$height2 = $maxheight;
$width2 = floor(($height2 * $width1) / $height1);