dev-master
9999999-dev
MIT
The Requires
- php >=5.4.0
- ext-gd *
- stil/gd-text ~1.0
by Rahul Gavande
generator avatar letter
1.0
1.0.0.0
MIT
The Requires
- php >=5.4.0
- ext-gd *
- stil/gd-text ~1.0
by Rahul Gavande
generator avatar letter
Provide a simple way to generate any file icon so that you don't to download icon each extension type., (*1)
composer require "gavande/extensions"
$icon = new Extensions\FileExtension(); $icon->generate('png', 40)->saveAsPng('/path/to/file.png'); # If you don't specify a size, the max size will be used (240 by default)
The font used by default is Open Sans Regular from google font. If you want, you can use any TTF font by setting the font file full path like so :, (*2)
$icon->setFontFile('path/to/ttf_file.ttf') ->generate('png', 40) ->saveAsPng('/path/to/file.png');
$icon->generate('png') ->saveAsJpeg('/path/to/file.jpg');
$icon->generate('png') ->saveAsPng('/path/to/file.png');
$icon->setTextColor([255, 0, 0]) ->generate('png') ->saveAsJpeg('/path/to/file.jpg');
$icon ->setTextColor([255, 0, 0]) ->generate('png') ->showTextShadow(false) ->saveAsJpeg('/path/to/file.jpg');
$icon ->setBackgroundColors([[255, 0, 0], [0, 255, 0], [0, 0, 255]]) ->generate('png') ->saveAsJpeg('/path/to/file.jpg');
You can chain multiple generation to keep the same background color. (Generating multiple sizes), (*3)
$icon ->generate('png', 50)->saveAsJpeg('/path/to/50x50/file.jpg') ->generate('png', 100)->saveAsJpeg('/path/to/100x100/file.jpg');
If you want you can reset background color (so that a new random one will be used) in the middle of chaining, (*4)
$icon ->generate('png', 50)->saveAsJpeg('/path/to/50x50/file.jpg') ->generate('png', 100)->saveAsJpeg('/path/to/100x100/file.jpg') ->resetBackgroundColor() ->generate('png', 100)->saveAsJpeg('/path/to/100x100/file.jpg');
MIT
generator avatar letter
MIT
generator avatar letter