11<?php
22
3+ /**
4+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
5+ * SPDX-License-Identifier: AGPL-3.0-or-later
6+ */
7+
38namespace OCA \OpenAi \Service ;
49
510use lsolesen \pel \PelEntryUndefined ;
@@ -25,15 +30,17 @@ public function markImage(string $image): string {
2530 $ white = imagecolorallocate ($ img , 255 , 255 , 255 );
2631 $ black = imagecolorallocate ($ img , 0 , 0 , 0 );
2732
28- $ w = imagefontwidth ($ font ) * strlen ($ text );
29- $ h = imagefontheight ($ font );
33+ $ w = imagefontwidth ($ font ) * strlen ($ text );
34+ $ h = imagefontheight ($ font );
3035 $ px = imagesx ($ img ) - $ w - 10 ;
3136 $ py = imagesy ($ img ) - $ h - 10 ;
3237
3338 // draw 1-pixel black outline by offsetting in 4 directions
3439 for ($ dx = -1 ; $ dx <= 1 ; $ dx ++) {
3540 for ($ dy = -1 ; $ dy <= 1 ; $ dy ++) {
36- if ($ dx || $ dy ) imagestring ($ img , $ font , $ px + $ dx , $ py + $ dy , $ text , $ black );
41+ if ($ dx || $ dy ) {
42+ imagestring ($ img , $ font , $ px + $ dx , $ py + $ dy , $ text , $ black );
43+ }
3744 }
3845 }
3946 imagestring ($ img , $ font , $ px , $ py , $ text , $ white );
@@ -87,8 +94,11 @@ public function markAudio(string $audio): string {
8794 file_put_contents ($ tempFile , $ audio );
8895
8996 $ getID3 = new \getID3 ;
90- $ getID3 ->setOption (array ('encoding ' =>'UTF-8 ' ));
91- \getid3_lib::IncludeDependency (GETID3_INCLUDEPATH .'write.php ' , __FILE__ , true );
97+ $ getID3 ->setOption (['encoding ' => 'UTF-8 ' ]);
98+ /**
99+ * @psalm-suppress UndefinedConstant
100+ */
101+ \getid3_lib::IncludeDependency (GETID3_INCLUDEPATH . 'write.php ' , __FILE__ , true );
92102 $ tagwriter = new \getid3_writetags ();
93103 $ tagwriter ->filename = $ tempFile ;
94104 $ tagwriter ->tagformats = ['id3v2.4 ' ];
@@ -103,4 +113,4 @@ public function markAudio(string $audio): string {
103113
104114 return $ newAudio ;
105115 }
106- }
116+ }
0 commit comments