src/Extension/Extension.php
public function getIcon()
    {
        $icon = $this->composerJsonAttribute('extra.flarum-extension.icon');
        $file = Arr::get($icon, 'image');

        if (is_null($icon) || is_null($file)) {
            return $icon;
        }

        $file = $this->path.'/'.$file;

        if (file_exists($file)) {
            $extension = pathinfo($file, PATHINFO_EXTENSION);
            if (! array_key_exists($extension, self::LOGO_MIMETYPES)) {
                throw new \RuntimeException('Invalid image type');
            }

            $mimetype = self::LOGO_MIMETYPES[$extension];
            $data = base64_encode(file_get_contents($file));

            $icon['backgroundImage'] = "url('data:$mimetype;base64,$data')";
        }

        return $icon;
    }
public function getIcon()
    {
        $icon = $this->composerJsonAttribute('extra.flarum-extension.icon');
        $file = Arr::get($icon, 'image');

        if (is_null($icon) || is_null($file)) {
            return $icon;
        }

        $file = $this->path.'/'.$file;

        if (file_exists($file)) {
            $extension = pathinfo($file, PATHINFO_EXTENSION);
            if (! array_key_exists($extension, self::LOGO_MIMETYPES)) {
                throw new \RuntimeException('Invalid image type');
            }

            $mimetype = self::LOGO_MIMETYPES[$extension];
            $data = base64_encode(file_get_contents($file));

            $icon['backgroundImage'] = "url('data:$mimetype;base64,$data')";
        }

        return $icon;
    }
public function getIcon ( ) { $ icon = $ this -> composerJsonAttribute ( 'extra.flarum-extension.icon' ) ; $ file = Arr :: get ( $ icon , 'image' ) ; if ( is_null ( $ icon ) || is_null ( $ file ) ) { return $ icon ; } $ file = $ this -> path . '/' . $ file ; if ( file_exists ( $ file ) ) { $ extension = pathinfo ( $ file , PATHINFO_EXTENSION ) ; if ( ! array_key_exists ( $ extension , self :: LOGO_MIMETYPES ) ) { throw new \ RuntimeException ( 'Invalid image type' ) ; } $ mimetype = self :: LOGO_MIMETYPES [ $ extension ] ; $ data = base64_encode ( file_get_contents ( $ file ) ) ; $ icon [ 'backgroundImage' ] = "url('data:$mimetype;base64,$data')" ; } return $ icon ; }
Loads the icon information from the composer.json.

@return array|null
Loads the icon information from the composer . json .