Created
July 26, 2012 05:36
-
-
Save sasezaki/3180444 to your computer and use it in GitHub Desktop.
Imagine_fontdraw_snippet
This file contains hidden or 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 | |
| use Imagine\Image\Box, | |
| Imagine\Image\Color, | |
| Imagine\Image\Point; | |
| //$path = 'tests/Imagine/Fixtures/font/Arial.ttf'; | |
| $path = ($argv[1]) ? $argv[1] : die; | |
| $black = new Color('000'); | |
| $text = "わーいうすしお\nあかリ うすしお\nだいすきー"; | |
| $imagine = new Imagine\Gd\Imagine; | |
| $canvas = $imagine->create(new Box(400, 300), new Color('fff')); | |
| $font = $imagine->font($path, 36, $black); | |
| $canvas->draw()->text($text, $font, new Point(0, 0), 0); | |
| $canvas->save('output.png'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment