http://happo.info/~iler/shotcutter.phps
You can ask questions from me about it and I can TRY to answer these questions. And for all the hax hax people those paths don't work on the server anymore, those are there only as an example

Moderator: Moderators
Code: Select all
function crop($imgOrig)
{
$imgSource = ImageCreateFromjpeg($imgOrig);
$x = imagesx($imgSource);
$y = imagesy($imgSource);
$mikux = 152;
$mikuy = 116;
$kokox = 335;
$kokoy = 165;
if($x == 640 || $y == 480) { $kx = $mikux; $ky = $mikuy; $check = "1";
} elseif($x > 640) { $kx = (($x - 640)/2) + $mikux; $ky = (($y - 480)/2) + $mikuy; $check = "1"; }
else { $kx = ((640 - $x)/2) - $mikux; $ky = ((480 - $y)/2) - $mikuy; $check = "1"; }
if($check) {
$imgCrop = imagecreatetruecolor($kokox,$kokoy);
ImageCopyResized($imgCrop, $imgSource, 0, 0, $kx, $ky, $kokox,$kokoy, $kokox, $kokoy);
unset($check);
return $imgCrop;
}
}
Code: Select all
#/bin/sh
X1=800
Y1=600
X2=640
Y2=480
convert -shave `expr \( $X1 - $X2 \) / 2`x`expr \( $Y1 - $Y2 \) / 2` $1 $2
Code: Select all
function convert_image($img)
{
if (empty($img[name])) { die ("Image field is empty."); }
if (!ereg ('.jpg$', strtolower($img[name]))) { die ("$img[name] is not a jpg file."); }
$image_src = imagecreatefromjpeg("$img[tmp_name]");
$old_size_x = imagesx($image_src);
$old_size_y = imagesy($image_src);
$extrasize = 3; //size of extra area around the score
$new_size_x = 320 + (2 * $extrasize);
$new_size_y = 152 + (2 * $extrasize);
//Calculate the coord where to cut
$cut_x = ($old_size_x / 2) - 160 - $extrasize;
$cut_y = ($old_size_y / 2) - 120 - $extrasize;
//Create new image
$image_dst = imagecreatetruecolor($new_size_x, $new_size_y);
imagecopy($image_dst, $image_src, 0, 0, $cut_x, $cut_y, $new_size_x, $new_size_y);
return $image_dst;
}