Laravel upload image to a mockup Tshirt image

Viewed 135

I am new to Laravel. I am trying to upload an image and insert it into a mockup tshirt image. I tried Image Intervention, but I could only insert an image to the mockup without taking the actual shape of the mockup. I tried Imagick but I couldn't get it installed on windows xampp.

below is my code:

Route::post('/upload', function (Request $request) {

    $UploadedImage = $request->file('image1');

    $mockupImage = Image::make('img/tshirt.png')
        ->resize(450, null, function ($constraint) {
            $constraint->aspectRatio();
        });

    $UploadedImage = Image::make($UploadedImage)
        ->resize(280,  null, function ($constraint) {
            $constraint->aspectRatio();
            $constraint->upsize();
        });

    $mockupImage->insert($UploadedImage, 'top', 0, 150);
    $mockupImage->response('jpg');
    
}); 

and I am only receiving two pictures upon each other:

enter image description here

Please if you can suggest me a library or find me a way on how to get this mockup done.

0 Answers
Related