ImageServiceHelper.php
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
namespace common\helpers;
use Resource\ImageService;
/**
* Class ImageServiceHelper
* @package app\common\helpers
*/
class ImageServiceHelper
{
/** @var **/
private static $service;
/**
* @return ImageService
*/
private static function getService()
{
if(null === self::$service){
self::$service = new ImageService();
}
return self::$service;
}
/**
* @param $path
* @param $destPath
* @return mixed
*/
public static function add($path, $destPath)
{
$service = self::getService();
return $service->add($path, $destPath);
}
/**
* @param $path
* @param null $style
* @return mixed
*/
public static function getUrl($path, $style = null)
{
$service = self::getService();
return $service->getUrl($path, $style);
}
/**
* @param $path
* @return mixed
*/
public static function delete($path)
{
$service = self::getService();
return $service->delete($path);
}
/**
* @param $oldPath
* @param $newPath
* @return mixed
*/
public static function replace($oldPath, $newPath, $tmpPath)
{
$service = self::getService();
return $service->replace($oldPath, $newPath, $tmpPath);
}
/**
* @param $path
* @return mixed
*/
public static function exists($path)
{
$service = self::getService();
return $service->exists($path);
}
/**
* @param $oldPath
* @param $newPath
* @return mixed
*/
public static function move($oldPath, $newPath)
{
$service = self::getService();
$service->move($oldPath, $newPath);
}
/**
* @param $paths
* @return mixed
*/
public static function batchDelete($paths)
{
$service = self::getService();
return $service->batchDelete($paths);
}
}