当前位置: 首页>>代码示例>>PHP>>正文


PHP Image::text方法代码示例

本文整理汇总了PHP中yii\imagine\Image::text方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::text方法的具体用法?PHP Image::text怎么用?PHP Image::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\imagine\Image的用法示例。


在下文中一共展示了Image::text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testText

 public function testText()
 {
     if (!$this->isFontTestSupported()) {
         $this->markTestSkipped('Skipping ImageGdTest Gd not installed');
     }
     $fontFile = Yii::getAlias('@yiiunit/data/imagine/GothamRnd-Light') . '.otf';
     $img = Image::text($this->imageFile, 'Yii-2 Image', $fontFile, [0, 0], ['size' => 12, 'color' => '000']);
     $img->save($this->runtimeTextFile);
     $this->assertTrue(file_exists($this->runtimeTextFile));
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:10,代码来源:AbstractImageTest.php

示例2: actionRegistration

 public function actionRegistration()
 {
     $model = new ContactFormV3();
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && $model->validate()) {
         $newTicketName = Yii::$app->getSecurity()->generateRandomString('16');
         $model->number = time();
         Image::text(Yii::getAlias('@frontend/web/img/basic/ticket.jpg'), $model->name, Yii::getAlias('@frontend/web/doc/roboto.ttf'), [295, 345], ['color' => '000'])->save(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), ['quality' => 100]);
         Image::text(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), $model->email, Yii::getAlias('@frontend/web/doc/roboto.ttf'), [510, 396], ['color' => '000'])->save(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), ['quality' => 100]);
         Image::text(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), $model->number, Yii::getAlias('@frontend/web/doc/roboto.ttf'), [428, 33], ['color' => 'fff'])->save(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), ['quality' => 100]);
         Image::text(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), $model->number, Yii::getAlias('@frontend/web/doc/roboto.ttf'), [615, 795], ['color' => '000'])->save(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), ['quality' => 100]);
         Image::text(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), $model->phone, Yii::getAlias('@frontend/web/doc/roboto.ttf'), [295, 396], ['color' => '000'])->save(Yii::getAlias('@frontend/web/tickets/' . $newTicketName . '.jpg'), ['quality' => 100]);
         $model->ticket = $newTicketName . '.jpg';
         if ($model->sendEmail(Yii::$app->params['supportEmail'])) {
             return 'success';
         } else {
             return 'Что то пошло не так :( Попробуйте позднее';
         }
     }
     return false;
     //throw new NotFoundHttpException('Page not found');
 }
开发者ID:sergey-exu,项目名称:myhome,代码行数:21,代码来源:SiteController.php

示例3: afterFileSave

 /**
  * After file save
  * Generate image thumb, if need.
  */
 public function afterFileSave()
 {
     $images = ['original' => $this->_filePath];
     // Thumbnail
     $thumb = $this->thumb;
     if (isset($thumb['generate']) && $thumb['generate']) {
         // Generate thumb image
         $images['thumbnail'] = $this->getThumbnailPath($images['original']);
         Image::thumbnail($images['original'], $thumb['width'], $thumb['height'])->save($images['thumbnail']);
     }
     // Add watermark to image
     $watermark = $this->watermark;
     if (isset($watermark['generate']) && $watermark['generate'] && !empty($watermark['content'])) {
         foreach ($images as $image) {
             if ($watermark['type'] == 'text') {
                 Image::text($image, $watermark['content'], __DIR__ . '/simkai.ttf', [10, 10])->save($image);
             } elseif ($watermark == 'image' && is_file($watermark['content'])) {
                 Image::watermark($image, $watermark['content']);
             }
         }
     }
 }
开发者ID:hiscaler,项目名称:yii2-file-upload-behaviors,代码行数:26,代码来源:ImageUploadBehavior.php


注:本文中的yii\imagine\Image::text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。