http://odyniec.net/projects/imgareaselect/examples.html
Do wybierana czesci zdjecia z jakiej ma zostac utworzona miniaturka. Mam potem metodę która z obrazka $tmp [nie zmniejszony] wytnie wybrany prostokat.
public function makeThumbnail( $tmp, $news_id, $x1, $x2, $y1, $y2, $width, $height ) { $news_id = (int) $news_id; if( $info[0] > 600 ) { $small_x = 600; } else { $small_x = $info[0]; } if( $info[1] > 450 ) { $small_y = 450; } else { $small_y = $info[1]; } $image = imagecreatefromjpeg( './public/thumbnail/news/tmp/' . $tmp ); $image_resized = imagecreatetruecolor( $small_x, $small_y ); imagecopyresampled( $image_resized, $image, 0, 0, 0, 0, $small_x, $small_y, $info[0], $info[1] ); $crop = imagecreatetruecolor( $small_x, $small_y ); imagecopy( $crop, $image_resized, 0, 0, $x1, $y2, $small_x, $small_y ); imagejpeg( $crop, null, 100 ); }
$tmp - oryginalny obrazek
$x1 - punkt x1 z imgAreaSelect
$x2 - punkt x2 z imgAreaSelect
$y1 - punkt y1 z imgAreaSelect
$y2 - punkt y2 z imgAreaSelect
$width - szerokosc prostokata z imgareaselect
$height - wysokosc ^
Problem jest najprawdopobniej w tej linijce
imagecopy( $crop, $image_resized, 0, 0, $x1, $y2, $small_x, $small_y );
Polega on na tym ze przekazuje z formularza wspolrzedne i wywoluje ta metode tj.
$this->makeThumbnail( '8201448e43ea4c6bf50705e801d01cd8.jpg', 4, 151,404, 29, 302, 404 - 151, 302 - 29 );
I wycina mi czesc obrazka, ale nie ta ktora powinno ...