datitisev should I change my profile picture then create a discussion and then change profile picture back?

    TOWUK What? The profile picture Flarum uses is the latest one. The image shown for the thumbnail is the first image found in the discussion's first post.

      datitisev i dont understand "first image", Where will I find him? how to specify it ???

        TOWUK If the first post in a discussion has an image embedded (can't be an imgur album), like here:

        Then the discussion thumbnail will use that image (in this case, it would use the Flarum logo if this was the first post int he discussion).

        There are NO options to specify, nor can you make the thumbnail a different image. It will only use images in the discussion's first post.

        datitisev My main expertise is in Android and embedded programming, so I do not know much about web development. However, I do know javascript, let me know if I can help. Or if you can give me a quick overview of your extension architecture (like which functions does what etc.) I think I can figure it out. I would love to have to feature on my forum 🙂

        14 days later

        Hi all devs. I hope you have a good day, i have used your thumbnail package and i was able to edit ui like this

        problem

        The problem is that whenever a user clicks on image the user is redirected to the author page

        intention

        When the user clicks on the image the user should be redirected to the discussion itself, the same behavior when someone clicks on the title

        It will be a lot easier, if u give me the extend.php script or add the feature as option in the extension in ur next update. Thanks
        Thanks for your time

          9 days later

          DanielOX You can do it with the CSS below. Thanks to @n512

          n512 .DiscussionListItem-author{
          margin-left: -95px;
          pointer-events: none;
          margin-left: 0px;
          }

          .DiscussionListItem-author .Avatar {
          width: 82px;
          height: 82px;
          border-radius: 7px;
          line-height: 82px;
          object-fit: cover;
          background-color: transparent;

          }

          .DiscussionListItem-content {
          padding-left: 10px;
          margin-bottom: 10px;
          padding-right: 50px;
          border-top:1px solid #EEE
          }

          .DiscussionListItem-main {
          margin-left: -82px;
          padding-left: 92px;
          padding-bottom: 50px;
          }

          There other UI changes in there as well, but I think the most important one is pointer-events: none;

          a month later

          I was wondering if there is any way to make that first image part of the metatags of each discussion so that it shows up nicely when sharing the discussion on Twitter/Facebook/Google. I believe this is quite an important feature in terms of SEO.

          Any chance this can be done with this extension?

            malago This extension doesn't do anything regarding SEO, so I don't think it'd make sense to add just one part of it. I think it'd probably make more sense in a SEO extension.

            19 days later
            4 months later

            0.2.0

            • beta 14 compatibility
            Updating
            composer require fof/discussion-thumbnail:^0.2.0
            php flarum cache:clear
            2 months later

            The 0.3.0 version of discussion-thumbnail seems to be crashing flraum 15

              dhub is there an error message you are able to share? PHP errors will be found in <flarum>/storage/logs. Javascript errors can be found in the browser javascript console.

              Nginx log shows the following

              2021/02/20 16:38:38 [error] 2501#2501: *124501 FastCGI sent in stderr: "PHP message: PHP Warning:  array_merge(): Argument #2 is not an array in /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php on line 102
              PHP message: PHP Warning:  array_merge(): Argument #1 is not an array in /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php on line 102
              PHP message: PHP Warning:  array_merge(): Argument #1 is not an array in /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php on line 102
              PHP message: PHP Warning:  array_merge(): Argument #1 is not an array in /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php on line 102
              PHP message: PHP Warning:  array_merge(): Argument #1 is not an array in /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php on line 102" while reading response header from upstream, client: , server:  , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: ""
              • dhub replied to this.

                dhub in the flarum log the error is about a FoF\Gamification, but it seems to be working fine

                [2021-02-20 23:38:38] flarum.ERROR: TypeError: Argument 3 passed to FoF\Gamification\AddDiscussionData::__invoke() must be of the type array, null given, called in /var/www/vendor/flarum/core/src/Foundation/ContainerUtil.php on line 30 and defined in /var/www/vendor/fof/gamification/src/AddDiscussionData.php:19
                Stack trace:
                #0 /var/www/vendor/flarum/core/src/Foundation/ContainerUtil.php(30): FoF\Gamification\AddDiscussionData->__invoke(Object(Flarum\Api\Serializer\DiscussionSerializer), Object(Flarum\Discussion\Discussion), NULL)
                #1 /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php(102): Flarum\Foundation\ContainerUtil::Flarum\Foundation\{closure}(Object(Flarum\Api\Serializer\DiscussionSerializer), Object(Flarum\Discussion\Discussion), NULL)

                Just looked at the earlier log, when no other 3rd party plugins were enabled Discussion thumbnail brought down the forum too, and the logs were as follows

                [2021-02-20 20:44:40] flarum.ERROR: TypeError: Argument 3 passed to Flarum\Api\Event\Serializing::__construct() must be of the type array, null given, called in /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php on line 110 and defined in /var/www/vendor/flarum/core/src/Api/Event/Serializing.php:56
                Stack trace:
                #0 /var/www/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php(110): Flarum\Api\Event\Serializing->__construct(Object(Flarum\Api\Serializer\DiscussionSerializer), Object(Flarum\Discussion\Discussion), NULL)
                #1 /var/www/vendor/tobscure/json-api/src/Resource.php(169): Flarum\Api\Serializer\AbstractSerializer->getAttributes(Object(Flarum\Discussion\Discussion), NULL)
                #2 /var/www/vendor/tobscure/json-api/src/Resource.php(75): Tobscure\JsonApi\Resource->getAttributes()
                #3 /var/www/vendor/tobscure/json-api/src/Document.php(187): Tobscure\JsonApi\Resource->toArray()
                #4 [internal function]: Tobscure\JsonApi\Document->Tobscure\JsonApi\{closure}(Object(Tobscure\JsonApi\Resource))
                #5 /var/www/vendor/tobscure/json-api/src/Document.php(188): array_map(Object(Closure), Array)
                #6 /var/www/vendor/tobscure/json-api/src/Document.php(224): Tobscure\JsonApi\Document->toArray()
                #7 /var/www/vendor/flarum/core/src/Api/JsonApiResponse.php(27): Tobscure\JsonApi\Document->jsonSerialize()
                #8 /var/www/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(139): Flarum\Api\JsonApiResponse->__construct(Object(Tobscure\JsonApi\Document))
                #9 /var/www/vendor/flarum/core/src/Api/Client.php(72): Flarum\Api\Controller\AbstractSerializeController->handle(Object(Laminas\Diactoros\ServerRequest))
                #10 /var/www/vendor/flarum/core/src/Frontend/Frontend.php(72): Flarum\Api\Client->send(Object(Flarum\Api\Controller\ShowForumController), Object(Flarum\User\User))
                #11 /var/www/vendor/flarum/core/src/Frontend/Frontend.php(51): Flarum\Frontend\Frontend->getForumDocument(Object(Laminas\Diactoros\ServerRequest))
                #12 /var/www/vendor/flarum/core/src/Frontend/Controller.php(32): Flarum\Frontend\Frontend->document(Object(Laminas\Diactoros\ServerRequest))
                #13 /var/www/vendor/flarum/core/src/Http/RouteHandlerFactory.php(38): Flarum\Frontend\Controller->handle(Object(Laminas\Diactoros\ServerRequest))
                #14 /var/www/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}(Object(Laminas\Diactoros\ServerRequest), Array)
                #15 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ExecuteRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Closure))
                #16 /var/www/vendor/flarum/core/src/Admin/Middleware/RequireAdministrateAbility.php(23): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #17 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Admin\Middleware\RequireAdministrateAbility->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #18 /var/www/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(40): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #19 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #20 /var/www/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(67): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #21 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ResolveRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #22 /var/www/vendor/flarum/core/src/Http/Middleware/SetLocale.php(50): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #23 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\SetLocale->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #24 /var/www/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(32): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #25 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #26 /var/www/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(51): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #27 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\RememberFromCookie->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #28 /var/www/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #29 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\StartSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #30 /var/www/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #31 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ParseJsonBody->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #32 /var/www/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #33 /var/www/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\HandleErrors->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
                #34 /var/www/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
                #35 /var/www/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))