Giter Site home page Giter Site logo

chrisbennett-bene / processfaviconmagic Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 502 KB

Easy-to-use favicon, web manifest and browserconfig generator for processwire. Designed just for processwire, FaviconMagic simplifies your workflow with custom markup and automatic generation of smarter options

License: Mozilla Public License 2.0

PHP 60.10% JavaScript 13.22% CSS 26.68%

processfaviconmagic's People

Contributors

chrisbennett-bene avatar

Stargazers

 avatar

Watchers

 avatar

processfaviconmagic's Issues

Some errors and warnings on PHP 7.4

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 :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.