Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $attachmentId = media_handle_upload('image', 0);
- $img= get_attached_file($attachmentId);
- function crop($filePath, $cropWidth, $cropHeight, $cropX, $cropY){
- // returns imageCreateFromJpeg($filepath),
- $image = $this->createImageFromAnyType($filepath);
- $cropped = imagecrop($image, ['x' => $cropX,
- 'y' => $cropY, 'width' => $cropWidth, 'height' => $cropHeight]);
- return $cropped ? imagejpeg($cropped) : false;
- }
Add Comment
Please, Sign In to add comment