Witam,
chciałbym, aby na jednym obrazku był obrazek kolorowy i szary - tak to całość wychodzi szara:
<?php
function createThumb($imgSrc, $thumbnail_width, $thumbnail_height)
{
$myImage = imagecreatefromjpeg($imgSrc);
$ratio_orig = $width_orig / $height_orig;
if($thumbnail_width / $thumbnail_height > $ratio_orig)
{
$new_height = $thumbnail_width / $ratio_orig;
$new_width = $thumbnail_width;
} else
{
$new_width = $thumbnail_height * $ratio_orig;
$new_height = $thumbnail_height;
}
$x_mid = $new_width / 2; //horizontal middle
$y_mid = $new_height / 2; //vertical middle
$process = imagecreatetruecolor
(round($new_width), round($new_height));
imagecopyresampled($process, $myImage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
$thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height);
imagecopyresampled($thumb, $process, 0, 0, ($x_mid - ($thumbnail_width / 2)), ($y_mid - ($thumbnail_height / 2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height);
imagedestroy($process);
imagedestroy($myImage);
return $thumb;
}
header('Content-Type: image/jpeg');
$new = imagecreatetruecolor(135, 285);
$bgColor = imagecolorallocate($new, 255, 255, 255);
imagefilledrectangle($new, 0, 0, 135, 285, $bgColor);
$img = createThumb("http://www.blog.twardowscy.pl/pliki/galeria/home/img8.jpg", 135, 135); //miniaturka
$img2 = $img;
imagefilter($img2, IMG_FILTER_GRAYSCALE);
imagecopyresized($new, $img, 0, 0, 0, 0, 135, 135, 135, 135);
imagecopyresized($new, $img2, 0, 145, 0, 0, 135, 135, 135, 135);
imagejpeg($new, '', 100);
?>