akagibi / myfavicon

CraftCMS plugin generating favicon.
MIT License
3 stars 1 forks source link

Error while trying to save settings #1

Open piotrpog opened 5 years ago

piotrpog commented 5 years ago

After I uploaded an image and tried to save plugin settings, I got this error:

Undefined index: extension
1. in C:\xampp\htdocs\test31\vendor\akagibi\myfavicon\src\MyFavicon.php at line 85
76777879808182838485868788899091929394 
            if ($asset) {
                $root = $_SERVER['DOCUMENT_ROOT'];
                $url = $asset->getUrl();
                $file = $root . $url;
                //$dir = $root . UrlHelper::rootRelativeUrl(UrlHelper::siteUrl());
                $dir = $root . '/';

                $pathinfo = pathinfo($file);
                $ext = strtolower($pathinfo['extension']);

                // Generating images
                $this->createThumb($ext, $file, $dir, 36, 36, 'android-icon-36x36.png');
                $this->createThumb($ext, $file, $dir, 48, 48, 'android-icon-48x48.png');
                $this->createThumb($ext, $file, $dir, 72, 72, 'android-icon-72x72.png');
                $this->createThumb($ext, $file, $dir, 96, 96, 'android-icon-96x96.png');
                $this->createThumb($ext, $file, $dir, 144, 144, 'android-icon-144x144.png');
                $this->createThumb($ext, $file, $dir, 192, 192, 'android-icon-192x192.png');
                $this->createThumb($ext, $file, $dir, 57, 57, 'apple-icon-57x57.png');
DickyMacias commented 3 years ago

I got the same issue. First of all I realized that I was using a S3 path, then I upload de file to temp files and when I start to generate the image, I got this error. Is there any solution about this or it is better to have the favicon in an old fashion way?