コード例 #1
0
ファイル: Imanee.php プロジェクト: robth82/imanee
 /**
  * Convenient method for generating text-only images
  *
  * @param string $text
  * @param Drawer $drawer
  * @param string $format
  * @param string $background
  * @return Imanee
  */
 public static function textGen($text, Drawer $drawer = null, $format = 'png', $background = 'transparent', ImageResourceInterface $resource = null)
 {
     $imanee = new Imanee(null, $resource);
     if ($drawer !== null) {
         $imanee->setDrawer($drawer);
     }
     $size = $imanee->resource->getTextGeometry($text, $imanee->getDrawer());
     $imanee->newImage($size['width'], $size['height'], $background);
     $imanee->setFormat($format);
     $imanee->placeText($text, Imanee::IM_POS_TOP_LEFT);
     return $imanee;
 }
コード例 #2
0
ファイル: ImaneeTest.php プロジェクト: girardiv/imanee
 /**
  * @expectedException Imanee\Exception\UnsupportedMethodException
  */
 public function testPlaceTextShouldThrowExceptionIfNotSupported()
 {
     $dummy = $this->getMock('Imanee\\Model\\ImageResourceInterface');
     $this->model->setResource($dummy);
     $this->model->placeText('testing');
 }