Skip to content

Instantly share code, notes, and snippets.

@sasezaki
Created July 26, 2012 05:36
Show Gist options
  • Select an option

  • Save sasezaki/3180444 to your computer and use it in GitHub Desktop.

Select an option

Save sasezaki/3180444 to your computer and use it in GitHub Desktop.
Imagine_fontdraw_snippet
<?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