Nuskaito esamus dydzius, tik as ju nekopinau. Su kodu cia viskas tvarkoje kai plotis gali buti betkoks. Bet man reikia, kad plotis butu lygiai 80px. Issitampo paveiksliukai kai taip padarau
1 2013-02-27 12:32:12
Re: Problema su paveiksleliu thumblaitu propocijomis (5 replies, posted in PHP)
2 2013-02-27 00:15:02
Topic: Problema su paveiksleliu thumblaitu propocijomis (5 replies, posted in PHP)
Sveiki,
Gal kas galite padeti? Kaip padaryti, kad paveikslelio thumblaitas nesitampytu. Jo plotis turi buti 80px, o aukstis proporcija nuo keliamo paveikslelio aukscio?
aprasom maksimalius dydzius
$twidth = "80"; // Maximum Width For Thumbnail Images
$theight = "180"; // Maximum Height For Thumbnail Images
--------------
resizinam thumblaita
if ($currheight > $currwidth) { // If Height Is Greater Than Width
$zoom = $twidth / $currheight; // Length Ratio For Width
$newheight = $theight; // Height Is Equal To Max Height
$newwidth = $currwidth * $zoom; // Creates The New Width
} else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height)
$zoom = $twidth / $currwidth; // Length Ratio For Height
$newwidth = $twidth; // Width Is Equal To Max Width
$newheight = $currheight * $zoom; // Creates The New Height