Last active
November 24, 2018 14:17
-
-
Save bayareawebpro/3bb1704d7ad0ac968594b9d4bb5d3fad to your computer and use it in GitHub Desktop.
FontAwesome SVG, Custom Fonts and Shapes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Intervention Image Package: | |
//http://image.intervention.io | |
Route::get('generate', function(){ | |
$text = 'image/jpg'; | |
$width = 1600; | |
$height = 1000; | |
$centerH = $width/2; | |
$centerV = $height/2; | |
$svg = base_path('node_modules/@fortawesome/fontawesome-free/svgs/regular/file.svg'); | |
$svg = \Intervention\Image\Facades\Image::make($svg); | |
$svg->opacity(15); | |
$img = \Intervention\Image\Facades\Image::canvas($width, $height, '#ff0000'); | |
$img->fill('#f3f3f3', 0, 0); | |
$img->ellipse($height/1.2, $height/1.2, $centerH, $centerV, function ($draw) { | |
$draw->background('#fff'); | |
}); | |
$img->insert($svg, 'center'); | |
$img->text($text, $centerH, $centerV, function($font) { | |
$font->file(base_path('fonts/MicroSquare Bold.ttf')); | |
$font->size(150); | |
$font->color('#000'); | |
$font->align('center'); | |
$font->valign('middle'); | |
}); | |
$cropW = 640; | |
$cropH = 480; | |
$img->heighten($cropH); | |
$img->crop($cropW,$cropH); | |
return $img->response('jpg', 90); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment