Skip to content

Commit 693a3f1

Browse files
committed
fix: Load deps only in Watermarking methods
Signed-off-by: Marcel Klehr <[email protected]>
1 parent dda97ed commit 693a3f1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/AppInfo/Application.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,5 @@ public function register(IRegistrationContext $context): void {
161161
}
162162

163163
public function boot(IBootContext $context): void {
164-
// Load PHP Exif Library for adding image metadata
165-
require_once(__DIR__ . '/../../vendor/fileeye/pel/autoload.php');
166-
// Load getID3 library for adding audio metadata
167-
require_once(__DIR__ . '/../../vendor/james-heinrich/getid3/getid3/getid3.php');
168164
}
169165
}

lib/Service/WatermarkingService.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public function markImage(string $image): string {
6161
}
6262

6363
private function addImageExifComment(string $text, string $filename): string {
64+
// Load PHP Exif Library for adding image metadata
65+
// We hope that it's not loaded yet. PHPScoper was a nightmare with this dep
66+
require_once(__DIR__ . '/../../vendor/fileeye/pel/autoload.php');
67+
6468
$peljpeg = new PelJpeg($filename);
6569
$exif = $peljpeg->getExif();
6670
if (!$exif) {
@@ -97,6 +101,10 @@ private function addImageExifComment(string $text, string $filename): string {
97101

98102
public function markAudio(string $audio): string {
99103
try {
104+
// Load getID3 library for adding audio metadata
105+
// We hope that it's not loaded yet. PHPScoper was a nightmare with this dep
106+
require_once(__DIR__ . '/../../vendor/james-heinrich/getid3/getid3/getid3.php');
107+
100108
$tempFile = $this->tempManager->getTemporaryFile('.mp3');
101109
file_put_contents($tempFile, $audio);
102110

0 commit comments

Comments
 (0)