src/lib/Photo.php
private static function placeholder($text)
    {
        $image_manager = new ImageManager(['driver' => 'imagick']);

        $image = $image_manager->canvas(640, 480, '#efefef');

        $image->text($text, 320, 240 - (70 * substr_count($text, "\n")), function ($font) {
            $font->file(base_path('vendor/webfontkit/open-sans/fonts/opensans-regular.woff'));
            $font->size(60);
            $font->color('#cbcbcb');
            $font->align('center');
            $font->valign('center');
        });

        $image_data = (string) $image->encode('gif');

        return 'data:image/gif;base64,'.base64_encode($image_data);
    }
private static function placeholder($text)
    {
        $image_manager = new ImageManager(['driver' => 'imagick']);

        $image = $image_manager->canvas(640, 480, '#efefef');

        $image->text($text, 320, 240 - (70 * substr_count($text, "\n")), function ($font) {
            $font->file(base_path('vendor/webfontkit/open-sans/fonts/opensans-regular.woff'));
            $font->size(60);
            $font->color('#cbcbcb');
            $font->align('center');
            $font->valign('center');
        });

        $image_data = (string) $image->encode('gif');

        return 'data:image/gif;base64,'.base64_encode($image_data);
    }
private static function placeholder ( $ text ) { $ image_manager = new ImageManager ( [ 'driver' => 'imagick' ] ) ; $ image = $ image_manager -> canvas ( 640 , 480 , '#efefef' ) ; $ image -> text ( $ text , 320 , 240 - ( 70 * substr_count ( $ text , "\n" ) ) , function ( $ font ) { $ font -> file ( base_path ( 'vendor/webfontkit/open-sans/fonts/opensans-regular.woff' ) ) ; $ font -> size ( 60 ) ; $ font -> color ( '#cbcbcb' ) ; $ font -> align ( 'center' ) ; $ font -> valign ( 'center' ) ; } ) ; $ image_data = ( string ) $ image -> encode ( 'gif' ) ; return 'data:image/gif;base64,' . base64_encode ( $ image_data ) ; }
Return a placeholder image containing the provided text.

@param string $text

@return string
Return a placeholder image containing the provided text .