daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $attachmentId = media_handle_upload('image', 0);
  2.    
  3. $img= get_attached_file($attachmentId);
  4.    
  5. function crop($filePath, $cropWidth, $cropHeight, $cropX, $cropY){
  6.  
  7.     // returns imageCreateFromJpeg($filepath),
  8.     $image = $this->createImageFromAnyType($filepath);
  9.  
  10.     $cropped = imagecrop($image, ['x' => $cropX,
  11.                        'y' => $cropY, 'width' => $cropWidth, 'height' => $cropHeight]);
  12.  
  13.     return $cropped ? imagejpeg($cropped) : false;
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top