MārisL Posted December 13, 2007 Report Share Posted December 13, 2007 Kā izveidot lai bilde būtu savā īstajā izmerā (piem. 46x56), bet, ja tā ir 144x666, tad tā būs tikai 90x90. Bildes urla tiek padota no db. Apmēram kā TE Link to comment Share on other sites More sharing options...
marcis Posted December 13, 2007 Report Share Posted December 13, 2007 Ticu, ka te forumā jau katukam tādam jābūt. Turklāt tu gribi bildi sagriezt proporcionāli vai vnk 90x90 ? Link to comment Share on other sites More sharing options...
andrisp Posted December 13, 2007 Report Share Posted December 13, 2007 Ar GD funkcijām resaizo. Vai kropo. http://www.google.lv/search?hl=lv&q=php+gd+resize Link to comment Share on other sites More sharing options...
Mikijs Posted January 2, 2008 Report Share Posted January 2, 2008 labākais veids "aspect ratio" kas ir aspect ratio <? function ResizeImage($imageNamePath, $target) { $mysock = getimagesize("$imageNamePath"); $width = $mysock[0]; $height = $mysock[1]; If ($width > $target OR $height > $target) { if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } $width = round($width * $percentage); $height = round($height * $percentage); } $imageSize['width'] = $width; $imageSize['height'] = $height; return $imageSize; } ?> un ar sekojošo kodu resaizo bildi $sizeAry = ResizeImage("$pathtopicture", 500); echo "<img src='" . $pathtopicture . "' width='" . $sizeAry['width'] . "' height='" . $sizeAry['height'] . "'>"; 500 pasaka funkcijai cik ir maksimalie izmeri pirms tiek samazinata bilde. Ceru ka šāds noderēs.. - ja nepalīdz tad list($width, $height, $type, $attr) = getimagesize("img/flag.jpg"); jeb <img src='' ... width='45'> :) Link to comment Share on other sites More sharing options...
Paulinjsh Posted January 2, 2008 Report Share Posted January 2, 2008 miljons reižu aprunāts forumā.. pats lietoju http://phpthumb.sourceforge.net/ Link to comment Share on other sites More sharing options...
Mikijs Posted January 2, 2008 Report Share Posted January 2, 2008 ā jā.. šitas arī lab.s Link to comment Share on other sites More sharing options...
Recommended Posts