View Single Post
Old 03-12-2008, 10:39 AM   #2 (permalink)
Rendair
The Addict
Upcoming Programmer Top Contributor 
 
Rendair's Avatar
 
Join Date: Nov 2007
Location: UK
Posts: 319
Thanks: 18
Rendair is on a distinguished road
Default

One way you can find the center point of an image is to find the width and height and divide by 2

PHP Code:
$size getimagesize($filename);
$width $size[0];
$height $size[1];

$x $width 2;
$y $height 2
Thats the way i have always done it anyway


You can always look at something like this

PHP Code:
// The file
$filename 'test.jpg';
$percent 0.5;

// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width$height) = getimagesize($filename);
$new_width $width $percent;
$new_height $height $percent;

// Resample
$image_p imagecreatetruecolor($new_width$new_height);
$image imagecreatefromjpeg($filename);
imagecopyresampled($image_p$image0000$new_width$new_height$width$height);

// Output
imagejpeg($image_pnull100); 
__________________
www.jooney.co.uk - the online portfolio
Send a message via MSN to Rendair
Rendair is offline  
Reply With Quote