osb/app/Http/Controllers/MediaController.php

27 lines
529 B
PHP
Raw Permalink Normal View History

2017-12-04 12:37:14 +00:00
<?php
namespace App\Http\Controllers;
use Image;
class MediaController extends Controller
{
/**
* Create a generic image
*
* @param $width
* @param $height
* @param string $color
2017-12-04 12:37:14 +00:00
* @return mixed
*/
public function image($width,$height,$color='#ccc') {
$io = Image::canvas($width,$height,$color);
$io->text(sprintf('IMAGE-%sx%s',$width,$height),$width/2,$height/2,function($font) {
$font->file(5);
$font->align('center');
$font->valign('middle');
});
return $io->response();
}
}