Jump to content

[SOLVED] Crop Image


GamingWarrior

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.