-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjpel.php
43 lines (35 loc) · 1.01 KB
/
jpel.php
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
<?php
/**
* @package jpel
* @author Dmitry Tsymbal <[email protected]>
* @copyright Copyright © 2019 Delo Design. All rights reserved.
* @license GNU General Public License version 3 or later; see license.txt
* @link https://delo-design.ru
*/
defined('_JEXEC') or die;
/**
* Class JPel
*/
class JPel
{
/**
* @param $file
* @return bool|JPelJpeg|JPelTiff
*/
public static function instance($file)
{
$nameSplit = explode('.', $file);
$exs = mb_strtolower(array_pop($nameSplit));
if(in_array($exs, ['jpg', 'jpeg']))
{
JLoader::register('JPelJpeg', JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'jpel' . DIRECTORY_SEPARATOR . 'jpeljpeg.php');
return new JPelJpeg($file);
}
if($exs === 'tiff')
{
JLoader::register('JPelTiff', JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'jpel' . DIRECTORY_SEPARATOR . 'jpeltiff.php');
return new JPelTiff($file);
}
return false;
}
}