Reputation: 127
I am trying to make an image cropper using Laravel. I have the following working php code to do that, but could anyone please tell me how can I achieve the same using Laravel?
$dst_x = 0;
$dst_y = 0;
$top = 15;
$left = 230;
$width = 200;
$height = 200;
$dst_image = imagecreatetruecolor($width, $height);
$src_image = imagecreatefromjpeg('public/upload/' . $filename);
imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $left, $top, $width, $height, $width, $height);
$random_name = rand() . ".jpg";
imagejpeg($dst_image, 'public/upload' . $random_name);
Upvotes: 0
Views: 6802
Reputation: 2101
There is no image manipulation implemented directly in the framework. You can do it either using standard PHP that you write in a controller or a helper, or with this package that is very useful and fully integrated with laravel.
Upvotes: 2