Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosinski/b6c80416c45722bbca4400b5d7cc59eb to your computer and use it in GitHub Desktop.
Save mosinski/b6c80416c45722bbca4400b5d7cc59eb to your computer and use it in GitHub Desktop.
$cropper_width = $data['additional_product_information']['cropper_width'];
$cropper_height = $data['additional_product_information']['cropper_height'];
$cropper_x = $data['additional_product_information']['cropper_x'];
$cropper_y = $data['additional_product_information']['cropper_y'];
$filename = $data['additional_product_information']['thumbnail_url'];
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename='.$src);
$image = imagecreatefromjpeg($filename);
$crop = imagecreatetruecolor($cropper_width,$cropper_height);
imagecopy ( $crop, $image, 0, 0, $cropper_x, $cropper_y, $cropper_width, $cropper_height );
$cropped_image = imagejpeg($crop);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment