[PHP] Thumbnails ausschneiden

web2null

ehem. assactions
ID: 131418
L
20 April 2006
1.775
165
Guten morgen, ich hätte da ne frage gibt es ne möglichkeit thubnails auszuschneiden. D.h. ich möchte folgendes machen, ich habe ein bild 640 x 480

r55d96p335lr.jpg


nun möchte ich ein stück davon mit php ausschneiden z.b.
so

4axsppm00ho0.jpg


und dieses stück dann noch verkleinern auf z.b. 120 px

u8rp106qoj00.jpg


das letzte dürfte ich hinbekommen, aber mit dem ausschneiden haperts hat einer n gutes tutorial oder weiss wie das geht?
 
danke hab nun folgendes gefunden

PHP:
	function cut($newX,$newY,$srcX = 0,$srcY = 0)
	{

		if ($this->img) {

			$X = ImageSX($this->img);
			$Y = ImageSY($this->img);

			$newX = $this->_convert($newX,$X);
			$newY = $this->_convert($newY,$Y);

			if (!$newX) {
				$newX = $X;
			}

			if (!$newY) {
				$newY = $Y;
			}

			if ( ! $newimg = ImageCreateTruecolor($X,$Y)) {
				$newimg = ImageCreate($X,$Y);
			}
			ImageCopy ($newimg,$this->img,0, 0, 0, 0,$X,$Y);
			ImageDestroy($this->img);
			if ( ! $this->img = ImageCreateTruecolor($newX, $newY)) {
				$this->img = ImageCreate($newX, $newY);
			}
			imagecopy ($this->img,$newimg, 0, 0,$srcX, $srcY, $newX, $newY);
 
			ImageDestroy($newimg);
			return true;

		} else {
			return false;
		}
	}
PHP:
<?php
	include_once("funktion.php");
	$thumbnail = new thumbnail();
	$thumbnail->create("bild.jpg");
	$thumbnail->setQuality(100);
	$thumbnail->resize(200);
	$thumbnail->autocut(100,100,5);
	$thumbnail->output();
?>

aber irgentwie bekomm ich das ausgeschnittene teil nicht gepeichert egal was ich versuche es kommen immer 0 bytes datein raus