예제 #1
0
 function ApplyFilter(&$imageString, $output = null)
 {
     $image = imagecreatefromstring($imageString);
     $imageSize = array(imagesx($image), imagesy($image));
     $imageWidth = $imageSize[0];
     $imageHeight = $imageSize[1];
     $newImageSize = $this->GetTransformedSize($imageSize);
     $newImageWidth = $newImageSize[0];
     $newImageHeight = $newImageSize[1];
     $result = imagecreatetruecolor($newImageWidth, $newImageHeight);
     ImageUtils::EnableAntiAliasing($result);
     imagecopyresampled($result, $image, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $imageWidth, $imageHeight);
     if ($output == null) {
         return imagejpeg($result);
     } else {
         imagejpeg($result, $output);
     }
 }