PluginProbe
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress / 3.2.1
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress v3.2.1
4.1.2 4.1.1 4.1.0 4.0.1 4.0.0 3.3.1 3.3.0 trunk 1.0.0 2.0.0 2.1.0 3.0.0 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8
quickwebp / includes / vendor / intervention / image / src / Intervention / Image / Commands / TextCommand.php

TextCommand.php in QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress 3.2.1, at includes/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php

35 lines 831 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image\Commands;
4
5 use Closure;
6
7 class TextCommand extends AbstractCommand
8 {
9 /**
10 * Write text on given image
11 * @param \Intervention\Image\Image $image
12 * @return boolean
13 */
14 public function execute($image)
15 {
16 $text = $this->argument(0)->required()->value();
17 $x = $this->argument(1)->type('numeric')->value(0);
18 $y = $this->argument(2)->type('numeric')->value(0);
19 $callback = $this->argument(3)->type('closure')->value();
20
21 $fontclassname = sprintf('\Intervention\Image\%s\Font',
22 $image->getDriver()->getDriverName());
23
24 $font = new $fontclassname($text);
25
26 if ($callback instanceof Closure) {
27 $callback($font);
28 }
29
30 $font->applyToImage($image, $x, $y);
31
32 return true;
33 }
34 }
35