Jump to content

resize wrongly with bad quality


uisneach

Recommended Posts

hello e.b. i got a issue with resizing script, the following

i think all the parameters are correcet

with this i got a fixe image very good as quality but i can only resize horizonatal pics

list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg');

// Creo la versione 120*90 dell'immagine (thumbnail)
$thumb = imagecreatetruecolor(120, 90);

$source = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg');
imagecopyresized($thumb, $source, 0, 0, 0, 0, 120, 90, $width, $height);


// Salvo l'immagine ridimensionata
imagejpeg($thumb, $_SERVER['DOCUMENT_ROOT']."public/foto/thumbnail/".$ultimo_id."_thumb.jpg", 75);

 

WHIT THIS ONE, I GOT A RESIZE WRONG , NOT AS I WISH (100PIX VERTICAL) and with very bad quality for the images with height higher than width (vertical, of course)

 

don't understand a.. ???


$imagehw=(list($width, $height,$attr,$type) =  getimagesize("public/foto/".$ultimo_id.".jpg"));
     $height = 100;
     $width = (int)(($imagehw[0]*100)/$imagehw[1]);
  $thumb = imagecreatetruecolor($width,$height);
$source = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg');
imagecopyresized($thumb, $source,0,0,0,0, $width, $height,$imagehw[0], $imagehw[1]);
    imagejpeg($thumb, $_SERVER['DOCUMENT_ROOT'].'public/foto/thumbnail/'.$ultimo_id.'_thumb.jpg',100);

anyone has a clue?

thanks in advance.

paolo

 

Link to comment
https://forums.phpfreaks.com/topic/147184-resize-wrongly-with-bad-quality/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.