hast du schon eine lösung? bei mir schaut das ungefähr so aus:
PHP-Code:
<?php
$height = 150;
$width = 100;
$img = $_GET['img'];
if(file_exists($img))
{
$dim = getimagesize($img);
switch ($dim[2]) {
case 2:
$cr = imagecreatefromjpeg($img);
break;
case 3:
$cr = imagecreatefrompng($img);
break;
default:
exit();
}
header("Content-type: " . image_type_to_mime_type($dim[2]));
$im = imagecreatetruecolor($width, $height);
// TODO: add random
$rnd_x = 0;
$rnd_y = 0;
imagecopy($im, $cr, 0, 0, 0+$rnd_x, 0+$rnd_y, $width+$rnd_x, $height+$rnd_y);
switch ($dim[2]) {
case 2:
imagejpeg($im);
break;
case 3:
imagepng($im);
break;
}
imagedestroy($cr);
imagedestroy($im);
}
?>