Pro ty co se treba nudej. zvladate nekdo tenhle script:
zjisteni - kdyz ne .jpg tak chyba (neni podminkou)
zmenseni (aby to nedeformovalo -  tzn. aby to z obr 200x100 neudelalo 100x100. myslim hlavne pomer fotek 2:3)
ulozeni na disk? Dik moc
                                 
                                 
                               
               
                              
                                 
                                      Nedávno to tu bylo. Používám tento skript:
Konstanta GAL_THUMBSIZE určuje největší rozměr náhledu.
function createthumb($s_file,$t_file,$kvalita=75){
   if (!($m_zdrojobrazek = @ImageCreateFromJPEG($s_file))) return false;
   $m_zdrwidth=imagesx($m_zdrojobrazek);
   $m_zdrheight=imagesy($m_zdrojobrazek);
   $m_vyswidth = $m_zdrwidth>=$m_zdrheight ? GAL_THUMBSIZE : GAL_THUMBSIZE/$m_zdrheight*$m_zdrwidth;
   $m_vysheight = $m_zdrwidth<$m_zdrheight ? GAL_THUMBSIZE : GAL_THUMBSIZE/$m_zdrwidth*$m_zdrheight;
   
   $m_vyslobrazek = imagecreatetruecolor($m_vyswidth,$m_vysheight);
   imagecopyresampled($m_vyslobrazek,$m_zdrojobrazek,0,0,0,0,$m_vyswidth,$m_vysheight,$m_zdrwidth,$m_zdrheight);
   ImageJPEG($m_vyslobrazek,$t_file,$kvalita);
   ImageDestroy($m_vyslobrazek);
   ImageDestroy($m_zdrojobrazek);
   return true;
}
                                 
                                 
                               
               
                              
                                 
                                      Možná by ti pomohl tenhle script, vytáhni si z něj co potřebuješ. Zmenší obrázek ( ?img=*.jpg) se zachováním poměru stran.
<?
dl("php_gd.dll");
Header("Content-type: image/jpeg");
Header("Expires: ".GMDate("D, d M Y H:i:s",time()+60*60*24)." GMT");
$width=100;
$height=100;
/* cílové velikosti*/
$img=ImageCreate($width,$height);
$bila=ImageColorAllocate($img,255,255,255);
ImageFill($img,0,0,$bila);
/* nový obrázek (náhled), bílé pozadí*/
$path=$_GET["path"];
$info=getimagesize($path);
$size=Round(filesize($path)/1024);
/* údaje o orginálu*/
if($info[0]<$info[1]):
  $w=$info[0]/$info[1]*$width;
  $h=$height;
  $top=0;
  $left=($width-$w)/2;
else:
  $w=$width;
  $h=$info[1]/$info[0]*$height;
  $top=($height-$h)/2;
  $left=0;
endif;
imagecopyresized($img,@imagecreatefromjpeg($path),$left,$top,0,0,$w,$h,$info[0],$info[1]);
/*
$cerna=ImageColorAllocate($img,0,0,0);
$bila=ImageColorAllocate($img,255,255,255);
imagefilledrectangle($img,0,$height-30,$width,$height-15,$bila);
$text=$info[0]."x".$info[1].", $size kB";
ImageString($img, 3, 10, $height-30, $text, $cerna);
/* zároveň do obrázku vypíše údaje o něm*/
ImageJpeg($img,'',80);
?>
                                 
                                 
                               
               
                              
                                 
                                      bohužel ani jeden z těch skriptů nemůžu rozchodit...   
našel jsem jinej:  tady je ale zase problém s kvalitou, je dost otřesná...
function resize($cur_file, $copy_file, $widthto, $heightto, $quality, $show, $interlace)
{
include "conf.tex";
$ssize=GetImageSize($cur_dir."/".$cur_file);		//get size
$end = Explode(".", $cur_file);		//oddìlení pøípony....nyní je pøípona pøístupná v promìnné $end[1]
if ((strtolower($end[1]) == "jpg") || (strtolower($end[1]) == "jpeg")):
	$fp = imagecreatefromjpeg ($cur_dir."/".$cur_file);
	$fx = imagecreate ($widthto,$heightto-1);
	imagecopyresized ($fx,$fp,0,0,0,0,$widthto,$heightto,$ssize[0],$ssize[1]);
	if ($interlace == "on"): ImageInterlace($fx , 1); endif;
	imageJPEG ($fx, $copy_file, $quality);
	Copy($copy_file, $copy_dir."/".$copy_file);
	unlink($copy_file);
	ImageDestroy($fp);
	ImageDestroy($fx);
	$kilo = Round(FileSize($copy_dir."/".$copy_file)/1024, 2);
	echo "<div align=\"center\"><b>".$cur_file." => ".$copy_file."</b><br><b>".$widthto." X ".$heightto." px ; ".$kilo." Kb</b><br></div>";
	if ($show == "on"): echo "<div align=\"center\"><img src=\"resized/".$copy_file."\"><br><br></div>"; endif;
elseif (strtolower($end[1]) == "png"):	
	If ( @$fp = imagecreatefrompng ($cur_dir."/".$cur_file) ):
		$fx = imagecreate ($widthto,$heightto-1);
		imagecopyresized ($fx,$fp,0,0,0,0,$widthto,$heightto,$ssize[0],$ssize[1]);
		if ($interlace == "on"): ImageInterlace($fx , 1); endif;
		imagePNG ($fx, $copy_file, $quality);
		Copy($copy_file, $copy_dir."/".$copy_file);
		unlink($copy_file);
		ImageDestroy($fp);
		ImageDestroy($fx);
		$kilo = Round(FileSize($copy_dir."/".$copy_file)/1024, 2);
		echo "<div align=\"center\"><b>".$cur_file." => ".$copy_file."</b><br><b>".$widthto." X ".$heightto." px ; ".$kilo." Kb</b><br></div>";
		if ($show == "on"): echo "<div align=\"center\"><img src=\"resized/".$copy_file."\"><br><br></div>"; endif;
	else:
		echo "<div align=\"center\" style=\"color: red;\">Your version of GD library doesn't support PNG images.<br>Image <b>".$cur_file."</b> wasn't resized. Sorry.<br><br></div>";
	endif;
endif;
}
if ($resize == "OK"):
	
//DL("php_gd.dll");						/*load DLL/
	include "conf.tex";
	$dp = OpenDir($cur_dir);					//nastaveni adresare - vraci ukazatel $dp
	$i = 0;
	$soubor[$i] = ReadDir($dp);
	while ($soubor[$i] == true):					//vypis vsech souboru v nastavenem adresari
		$pis = ReadDir($dp);
		$i++;
		$soubor[$i] = $pis;					//$soubor[2] je prvnim souborem v adresari
	endwhile;					//zachována promenna $i, ktera je pocet souboru +2
	CloseDir($dp);
	
	for ($y=2; $y<=$i-1; $y++):
		$size[$y] = GetImageSize($cur_dir."/".$soubor[$y]);
		$width = $size[$y][0];
		$height = $size[$y][1];
		if ($new_width <= $new_height):
			$widthto = $new_width;
			$ratio = $width/$widthto;
			$heightto = Ceil($height/$ratio);
		else:
			$heightto = $new_height;
			$ratio2 = $height/$heightto;
			$widthto = Ceil($width/$ratio2);
		endif;
		$outfile = Str_Replace(" ", "_", $soubor[$y]);
		$outfile = strtr($outfile, "áèïìéíòøšùúýžüäëö", "acdeeinrstuuyzuaeo");
		$outfile = StrToLower($outfile);
		resize($soubor[$y], "small_".$outfile, $widthto, $heightto, $quality, $show, $interlace);
	endfor;
endif;
?>
                                 
                                 
                               
               
                              
                                 
                                      ty jo to je trosku slozity ne? pomoci gd knihovny to de docela jednoduse
pak akorat udelas vystup v php jako obr a parametry width a heigth das ty zmenseny... koukni se do manualu php tam je to primo popsany... u gd knihovny
                                 
                                 
                               
               
                              
                                 
                                      no našel jsem ještě něco jinýho a lepšího...
$imgfile = '6.JPG';
$percent = 0.2;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($imgfile);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = ImageCreateTrueColor($newwidth,$newheight);
$source = imagecreatefromjpeg($imgfile);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb);
samostatně to funguje jedna báseň když to ale chci spojit s uploadem tak to prostě nejde...  nějaké návrhy?