2022-01-16

Watermark Font Text Overlay Sizing issue with Laravel 8

Using Demo file from https://www.positronx.io/laravel-add-text-overlay-watermark-on-image-tutorial/

Have Installed Intervention/Image and config/app.php along with routes all working fine.

It will change the Font color and Font position but not the Font size Not sure where the fonts are loaded - Be good to use a TT font but don't know where to store the uploaded font - I'm a novice with Laravel/Intervention and need specific path/folderforfont/ in LaravelApp

public function imageFileUpload(Request $request)
    {
        $this->validate($request, [
            'file' => 'required|image|mimes:jpg,jpeg,png,gif,svg|max:4096',
        ]);

        $image = $request->file('file');
        $input['file'] = time().'.'.$image->getClientOriginalExtension();

        $imgFile = Image::make($image->getRealPath());

        $imgFile->text('© 2016-2020 positronX.io - All Rights Reserved', 120, 100, function($font) { 
            $font->size(35);  
            $font->color('#ffffff');  
            $font->align('center');  
            $font->valign('bottom');  
            $font->angle(90);  
        })->save(public_path('/uploads').'/'.$input['file']);          

        return back()
            ->with('success','File successfully uploaded.')
            ->with('fileName',$input['file']);         
    }
}


from Recent Questions - Stack Overflow https://ift.tt/3tv3nUV
https://ift.tt/eA8V8J

No comments:

Post a Comment