dimanche 1 octobre 2017

Laravel image crop

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);

Thanks in advance for the help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire