Hey @chrisbennett-Bene!
Gave this module a try today, but it turns out there are a few errors while editing the favicons page. At least some of these will likely only show up for PHP 7.4 or later:
Oye… Compile Error: Unparenthesized a ? b : c ? d : e
is not supported. Use either (a ? b : c) ? d : e
or a ? b : (c ? d : e)
(line 324 of site/modules/ProcessFaviconMagic/Engine/FaviconMagicPreview.php)
Here's a quick fix I added on my installation to get past this:
diff --git a/Engine/FaviconMagicPreview.php b/Engine/FaviconMagicPreview.php
index 4cf07af..be806a2 100644
--- a/Engine/FaviconMagicPreview.php
+++ b/Engine/FaviconMagicPreview.php
@@ -322,10 +322,10 @@ foreach ( $faviconsArray as $faviconLinks => $fields ) {
$themeContrastColor = themeContrastSwitch($themeColor);
$mobileInfoFilter = ($themeContrastColor == '#000000') ? ' style="filter:invert(1);opacity:.7;"' : '';
$mobileAppIconLink = file_exists(FOLDER_PATH . 'favicon.svg')
- ? ' <img src="' . FOLDER_URL . 'favicon.svg?v='. mt_rand( 1000, 9999 ) . '">' :
+ ? ' <img src="' . FOLDER_URL . 'favicon.svg?v='. mt_rand( 1000, 9999 ) . '">' : (
file_exists(FOLDER_PATH . 'favicon-192x192.png')
? ' <img src="' . FOLDER_URL . 'favicon-192x192.png?v='. mt_rand( 1000, 9999 ) . '">' :
- '';
+ '');
$mobileHomeAppIcon = file_exists(FOLDER_PATH . 'maskable-512x512.png')
? ' style="background-image: url(' . FOLDER_URL . 'maskable-512x512.png?v='. mt_rand( 1000, 9999 ) . ');"' :
'';
Also ran into a couple of issues while trying to generate new favicons:
Darn… Fatal Error: Uncaught Error: Class "ImageSizer" not found in site/modules/ProcessFaviconMagic/Engine/FaviconMagicFaviconGenerator.php:32
This one was fixed by adding the \ProcessWire\ namespace before ImageSizer on said row.
Ouch… Fatal Error: Uncaught Error: Class "Imagick" not found in site/modules/ProcessFaviconMagic/Engine/FaviconMagicFaviconGenerator.php:154
The module seems to require Imagick — though perhaps this is intentional? Either way might be a good idea to add a note about this to module README and perhaps check for it in advance, so that it doesn't crash the admin page.
Additionally there were some non-fatal notices:
Warning: Undefined variable $previousFolders in /site/modules/ProcessFaviconMagic/Engine/FaviconMagicPreview.php on line 495
Warning: file_put_contents(/site/assets/files/faviconMarkup/previousFolders.php): Failed to open stream: No such file or directory in /site/modules/ProcessFaviconMagic/Engine/FaviconMagicPreview.php on line 495
Warning: Undefined variable $previousFolders in /site/modules/ProcessFaviconMagic/Engine/FaviconMagicPreview.php on line 498
Warning: foreach() argument must be of type array|object, null given in /site/modules/ProcessFaviconMagic/Engine/FaviconMagicPreview.php on line 498
Anyway, thanks for the module! It looks promising :)