1 | <?php |
||
7 | class ZipFile extends AbstractDrawingAdapter |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $path; |
||
13 | |||
14 | /** |
||
15 | * Get Path |
||
16 | * |
||
17 | * @return string |
||
18 | */ |
||
19 | 8 | public function getPath() |
|
23 | |||
24 | /** |
||
25 | * Set Path |
||
26 | * |
||
27 | * @param string $pValue File path |
||
28 | * @return \PhpOffice\PhpPresentation\Shape\Drawing |
||
29 | */ |
||
30 | 8 | public function setPath($pValue = '') |
|
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | 3 | public function getContents() |
|
52 | |||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 5 | public function getExtension() |
|
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | 6 | public function getMimeType() |
|
66 | { |
||
67 | 6 | if (!CommonFile::fileExists($this->getZipFileOut())) { |
|
68 | 2 | throw new \Exception('File '.$this->getZipFileOut().' does not exist'); |
|
69 | } |
||
70 | 4 | $oArchive = new \ZipArchive(); |
|
71 | 4 | $oArchive->open($this->getZipFileOut()); |
|
72 | 4 | if (!function_exists('getimagesizefromstring')) { |
|
73 | 3 | $uri = 'data://application/octet-stream;base64,' . base64_encode($oArchive->getFromName($this->getZipFileIn())); |
|
74 | 3 | $image = getimagesize($uri); |
|
75 | } else { |
||
76 | 1 | $image = getimagesizefromstring($oArchive->getFromName($this->getZipFileIn())); |
|
77 | } |
||
78 | 4 | return image_type_to_mime_type($image[2]); |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | 3 | public function getIndexedFilename() |
|
93 | |||
94 | 7 | protected function getZipFileOut() |
|
100 | |||
101 | 7 | protected function getZipFileIn() |
|
107 | } |
||
108 |