J-EX Posted January 6, 2007 Report Share Posted January 6, 2007 Tātad esmu uzrakstījis skriptu, kas samazina bildes. Vis darbojas lieliski, bet bilžu kvalitāte acīmredzami klibo... :( lai izveidotu bildes failu izmantoju funkciju: imagejpeg() .... quality norādu uz 100... bet bildes sanāk tādas "robainas", itkā būtu slikts krāsu kontrasts... Vai kāds var ieteikt kautko? Paldies... Link to comment Share on other sites More sharing options...
Kristabs Posted January 6, 2007 Report Share Posted January 6, 2007 Ieliec visu skriptu, kā samazini bildes. Link to comment Share on other sites More sharing options...
J-EX Posted January 6, 2007 Author Report Share Posted January 6, 2007 (edited) //saglabaajam bildes if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg") && ($_FILES["file"]["size"] < 2000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { // ielaadeetaa faila satura ieguana $pic1 = ImageCreateFromJpeg($_FILES["file"]["tmp_name"]); $h=ImageSY($pic1); $w=ImageSX($pic1); // bil˛u izmeru konstantes $min = 130; $max = 300; // kvalitaates konstante $q = 100; $location = getcwd()."/small/".$bfile; $locationmax = getcwd()."/large/".$bfile; // ----- veidojam mazo bildi if($h>$w){ $h1 = $min; $w1 = floor($h1/$h*$w); $thumb = imagecreatetruecolor($w1, $h1); imagecopyresized($thumb, $pic1, 0, 0, 0, 0, $w1, $h1, $w, $h); imagejpeg($thumb,$location,$q); } // un taa talaak... bildes tiek saglabaatas peec proporcijaam... tas ir fragments no koda Edited January 6, 2007 by J-EX Link to comment Share on other sites More sharing options...
john.brown Posted January 6, 2007 Report Share Posted January 6, 2007 imagecopyresized() vietā lieto imagecopyresampled() - kvalitāte būs labāka, slodze serverim lielāka, ātrdarbība - lēnāka ;) Link to comment Share on other sites More sharing options...
J-EX Posted January 6, 2007 Author Report Share Posted January 6, 2007 john.brown liels paldies par atbildi... tagad bildes tieshaam sanaak uz 100 % :DDD Link to comment Share on other sites More sharing options...
Recommended Posts