Ejemplo n.º 1
0
 private static function _transform($fileName, $toWidth, $toHeight, $typeTransform)
 {
     //funkcja zwraca uchwyt do zasobu
     //zasob jest przeskalowanym odpowiednio obrazkiem
     $inImage = ImageCreateFromJPEG($fileName);
     $imgWidth = ImageSX($inImage);
     $imgHeight = ImageSY($inImage);
     $size = ImageTransform::_compute_size($imgWidth, $imgHeight, $toWidth, $toHeight, $typeTransform);
     $outImage = ImageCreatetruecolor($size['width'], $size['height']);
     imagecopyresampled($outImage, $inImage, 0, 0, 0, 0, $size['width'], $size['height'], $imgWidth, $imgHeight);
     return $outImage;
 }