Mailinglisten-Archive |
also hab mal ne methode gebastelt, irgendwo hab ich glaub
noch nen fehler drinn oder ich hab nen krummen blick.
die $this->src/$this->dst stehen halt für quell/zielbild
musst di halt nach bedarft ändern.
//$x/$y geben die werte für das zielbild an
function thumb($x, $y){
$this->create($x, $y);
$width = imagesx($this->src);
$height = imagesy($this->src);
if ($width > $height) {
$xfactor = ($width/$height);
$xcrop = ((($xfactor*100)-100))*$xfactor;
imagecopyresampled($this->dst, $this->src,
0, 0, //dst x, y
$xcrop/2, 0, //src x, y
$x, $y, //dst width, height
$width-$xcrop, $height //src width, height );
}else{
$yfactor = ($height/$width);
$ycrop = ((($yfactor*100)-100))*$yfactor;
imagecopyresampled($this->dst, $this->src,
0, 0, //dst x, y
0, $ycrop/2, //src x, y
$x, $y, //dst width, height
$width, $height-$ycrop //src width, height
);
}
}
php::bar PHP Wiki - Listenarchive