GamingWarrior Posted October 14, 2007 Share Posted October 14, 2007 Ok, this is driving me crazy. I want to crop: to but all the scripts i find to crop seem to just shrink the image and cut the edges to make it keep the ratio If someone can just tell me where to start i might be able to work it out from there. Thanks Link to comment https://forums.phpfreaks.com/topic/73235-solved-crop-image/ Share on other sites More sharing options...
Barand Posted October 15, 2007 Share Posted October 15, 2007 Do you know the coordinates of the area to crop Anyway, assuming [pre] 60,50 +----------+ | | | | | | +----------+ 120,90 [/pre] <?php $x1 = 60; $y1 = 50; $x2 = 120; $y2 = 90; $w = $x2 - $x1; $h = $y2 - $y1; $dest = imagecreatetruecolor($w, $h); $src = imagecreatefromjpeg ('original.jpg'); imagecopy($dest, $src, 0, 0, $x1, $y1, $w, $h); imagejpeg($dest); imagedestroy($dest); imagedestroy($src); ?> Link to comment https://forums.phpfreaks.com/topic/73235-solved-crop-image/#findComment-369559 Share on other sites More sharing options...
GamingWarrior Posted October 15, 2007 Author Share Posted October 15, 2007 Thanks A heap, works perfect I was looking at it as being a hard and long process when its quite the opposite. Link to comment https://forums.phpfreaks.com/topic/73235-solved-crop-image/#findComment-369727 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.