• Extensions
  • Boring Avatars - self hosted generated avatars based on various themes

I typed

ianm/boring-avatars

in the box and clicked the " Proceed " button

  • IanM replied to this.

    meetdilip I'd suggest a good starting point would be to try clearing the cache and/or checking the logs

    Hi, I am not sure where the XAMPP logs are, will check.

    You are right about the cache. When I tried a different browser, the new avatars are showing. But the settings are still the same as above.

    • ctml replied to this.

      Hi, under storage > logs I see around 120 times " boring ". Not sure which part of the log is useful to identify the issue

      the top area of the log says

      [2024-01-19 09:47:26] flarum.ERROR: Illuminate\Contracts\Container\BindingResolutionException: Target [IanM\BoringAvatars\BoringAvatar] is not instantiable while building [IanM\BoringAvatars\Command\GenerateAvatarHandler]. in /opt/lampp/htdocs/flarum_public/vendor/illuminate/container/Container.php:1089
      Stack trace:
      #0 /opt/lampp/htdocs/flarum_public/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable('IanM\BoringAvat...')
      #1 /opt/lampp/htdocs/flarum_public/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build('IanM\BoringAvat...')

      9 days later

      IanM Great extension! Is it possible to add a setting to use this only for user accounts where there is no profile picture?

        I can get avatars with api but it is not shown at interface. I guess it caused by directory of my forum but I am not sure. It is located in main path instead of public folder

        site.php

        <?php
        
        /*
         * This file is part of Flarum.
         *
         * For detailed copyright and license information, please view the
         * LICENSE file that was distributed with this source code.
         */
        
        /*
        |-------------------------------------------------------------------------------
        | Load the autoloader
        |-------------------------------------------------------------------------------
        |
        | First, let's include the autoloader, which is generated automatically by
        | Composer (PHP's package manager) after installing our dependencies.
        | From now on, all classes in our dependencies will be usable without
        | explicitly loading any files.
        |
        */
        
        require __DIR__.'/vendor/autoload.php';
        
        /*
        |-------------------------------------------------------------------------------
        | Configure the site
        |-------------------------------------------------------------------------------
        |
        | A Flarum site represents your local installation of Flarum. It can be
        | configured with a bunch of paths:
        |
        | - The *base path* is Flarum's root directory and contains important files
        |   such as config.php and extend.php.
        | - The *public path* is the directory that serves as document root for the
        |   web server. Files in this place are accessible to the public internet.
        |   This is where assets such as JavaScript files or CSS stylesheets need to
        |   be stored in a default install.
        | - The *storage path* is a place for Flarum to store files it generates during
        |   runtime. This could be caches, session data or other temporary files.
        |
        | The fully configured site instance is returned to the including script, which
        | then uses it to boot up the Flarum application and e.g. accept web requests.
        |
        */
        
        return Flarum\Foundation\Site::fromPaths([
            'base' => __DIR__,
            'public' => __DIR__.'/public',
            'storage' => __DIR__.'/storage',
        ]);

        index.php that is under public folder

        <?php
        
        /*
         * This file is part of Flarum.
         *
         * For detailed copyright and license information, please view the
         * LICENSE file that was distributed with this source code.
         */
        
        $site = require '../site.php';
        
        /*
        |-------------------------------------------------------------------------------
        | Accept incoming HTTP requests
        |-------------------------------------------------------------------------------
        |
        | Every HTTP request pointed to the web server that cannot be served by simply
        | responding with one of the files in the "public" directory will be sent to
        | this file. Now is the time to boot up Flarum's internal HTTP server, which
        | will try its best to interpret the request and return the appropriate
        | response, which could be a JSON document (for API responses) or a lot of HTML.
        |
        */
        
        $server = new Flarum\Http\Server($site);
        $server->listen();

        NGINX FILE

        server {
            listen      195.XXX.XXX.XXX:443 ssl;
            server_name domain.com www.domain.com;
            root        /home/user/web/domain.com/public_html/public;
            index       index.php index.html index.htm;
            access_log  /var/log/nginx/domains/domain.com.log combined;
            access_log  /var/log/nginx/domains/domain.com.bytes bytes;
            error_log   /var/log/nginx/domains/domain.com.error.log error;
        
            ssl_certificate      /home/user/conf/web/domain.com/ssl/domain.com.pem;
            ssl_certificate_key  /home/user/conf/web/domain.com/ssl/domain.com.key;
            ssl_stapling on;
            ssl_stapling_verify on;
        
            include /home/user/conf/web/domain.com/nginx.hsts.conf*;
        
            location = /favicon.ico {
                log_not_found off;
                access_log off;
            }
        
            location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
            }
        
            location ~ /\.(?!well-known\/) {
                deny all;
                return 404;
            }
        
            location / {
                try_files $uri $uri/ /index.php?$args;
                location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
                    expires 30d;
                    fastcgi_hide_header "Set-Cookie";
                }
        
                location ~* /(?:uploads|files)/.*.php$ {
                    deny all;
                    return 404;
                }
        
                location ~ [^/]\.php(/|$) {
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    try_files $uri =404;
                    fastcgi_pass unix:/run/php/php8.2-fpm-domain.com.sock;
                    fastcgi_index index.php;
                    include /etc/nginx/fastcgi_params;
                    include /home/user/conf/web/domain.com/nginx.fastcgi_cache.conf*;
                    if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
                        set $no_cache 1;
                    }
                    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {
                        set $no_cache 1;
                    }
                }
            }
        
        # WORDPRESS #
            location ^~ /vitrin {
            	root        /home/user/web/domain.com/public_html;
                index index.php index.html index.htm;
                try_files $uri $uri/ /vitrin/index.php?$query_string;
        
                location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
                    expires max;
                    fastcgi_hide_header "Set-Cookie";
                }
        
                location ~ [^/]\.php(/|$) {
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    try_files $uri =404;
                    fastcgi_pass unix:/run/php/php8.2-fpm-domain.com.sock;
                    fastcgi_index index.php;
                    include /etc/nginx/fastcgi_params;
                    include /home/user/conf/web/domain.com/nginx.fastcgi_cache.conf*;
                    if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
                        set $no_cache 1;
                    }
                    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {
                        set $no_cache 1;
                    }
                }
             }
        
        
            location /error/ {
                alias   /home/user/web/domain.com/document_errors/;
            }
        
            location /vstats/ {
                alias   /home/user/web/domain.com/stats/;
                include /home/user/web/domain.com/stats/auth.conf*;
            }
        
            proxy_hide_header Upgrade;
        
            include /etc/nginx/conf.d/phpmyadmin.inc*;
            include /etc/nginx/conf.d/phppgadmin.inc*;
            include /home/user/conf/web/domain.com/nginx.ssl.conf_*;
        }

        I like it! It would be nice if a preview were generated in real time when modifying the colours (or a button to generate preview) so that you could view an example with your chosen colour scheme before having it generate all of the avatar images.

          ctml you can see a sample of every option in the extension introduction post.

          • ctml replied to this.

            GreXXL yep I do see it thanks, but I mean it would be nice to see a handful of avatars generated in real-time and previewed in the settings page.

            after I generated mine, I decided I didn't like the colour scheme I chose and some colours were too similar to one another so I went in to generate a new set with different colours, and I did it another time. if there were a preview of a small number of avatars generated when you click a preview button, then I could hack away with the colours and themes quickly to find a combination that looks good 🙂

            not a big deal of course, just a nice to have!

              7 days later