PluginProbe
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress / 3.2.0
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress v3.2.0
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 / ImageManagerStatic.php

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

89 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image;
4
5 use Closure;
6
7 class ImageManagerStatic
8 {
9 /**
10 * Instance of Intervention\Image\ImageManager
11 *
12 * @var ImageManager
13 */
14 public static $manager;
15
16 /**
17 * Creates a new instance
18 *
19 * @param ImageManager $manager
20 */
21 public function __construct(ImageManager $manager = null)
22 {
23 self::$manager = $manager ? $manager : new ImageManager;
24 }
25
26 /**
27 * Get or create new ImageManager instance
28 *
29 * @return ImageManager
30 */
31 public static function getManager()
32 {
33 return self::$manager ? self::$manager : new ImageManager;
34 }
35
36 /**
37 * Statically create new custom configured image manager
38 *
39 * @param array $config
40 *
41 * @return ImageManager
42 */
43 public static function configure(array $config = [])
44 {
45 return self::$manager = self::getManager()->configure($config);
46 }
47
48 /**
49 * Statically initiates an Image instance from different input types
50 *
51 * @param mixed $data
52 *
53 * @return \Intervention\Image\Image
54 * @throws \Intervention\Image\Exception\NotReadableException
55 */
56 public static function make($data)
57 {
58 return self::getManager()->make($data);
59 }
60
61 /**
62 * Statically creates an empty image canvas
63 *
64 * @param int $width
65 * @param int $height
66 * @param mixed $background
67 *
68 * @return \Intervention\Image\Image
69 */
70 public static function canvas($width, $height, $background = null)
71 {
72 return self::getManager()->canvas($width, $height, $background);
73 }
74
75 /**
76 * Create new cached image and run callback statically
77 *
78 * @param Closure $callback
79 * @param int $lifetime
80 * @param boolean $returnObj
81 *
82 * @return mixed
83 */
84 public static function cache(Closure $callback, $lifetime = null, $returnObj = false)
85 {
86 return self::getManager()->cache($callback, $lifetime, $returnObj);
87 }
88 }
89