• Extensions
  • FriendsOfFlarum upload, the intelligent file attachment extension

I am wondering with one question with this extension, I wish to define the upload folder to be delivered from a subdomain, in order to improve the page loading speed, but I am not able to figure out how to achieve this result any working solution can be of great help...

    turtlekey we have a few issues about that on GitHub, but no easy solution. There's a limitation at both the filename on disk and the label we can show in the interface with the current solution FriendsOfFlarum/upload207

    s1-ranjan you can use the "CDN URL" option in the settings to configure the URL that should be used instead of the normal base URL. This works for any adapter, including local.

      clarkwinkelmann you can use the "CDN URL" option in the settings to configure the URL that should be used instead of the normal base URL. This works for any adapter, including local.

      What should be the base of the subdomain /assets or /assets/files ?

        s1-ranjan with the local adapter, /assets/files/<filename> will be added after that CDN URL, and defaults to the Flarum base URL if no CDN URL is provided.

          clarkwinkelmann whenever I upload any image, I am getting this output
          [upl-image-preview url=/assets/files/assets/files/2020-08-30/1598821057-530685-english.png]
          whereas the expected result should have been something like
          [upl-image-preview url=/assets/files/2020-08-30/1598821057-530685-english.png] to work properly, I think this is a bug in this plugin.

            s1-ranjan what did you set as the CDN URL? Do you have a protocol and domain appearing in front or is it really just a path without domain name?

              clarkwinkelmann Today I have seen my issue has been resolved, it is working normally as aspected well regarding your question I have entered the following value for CDN URL
              Content Delivery URL (prefixes files): /assets/files
              Till yesterday the URL of the uploaded images was :
              [upl-image-preview url=/assets/files/assets/files/2020-08-30/1598821057-530685-english.png],
              but today I find the uploaded images are using
              [upl-image-preview url=/assets/files/2020-08-30/1598821057-530685-english.png]
              In both situations the URL has not used or reflecting the protocol or domain name in front, i.e., it is using a path without a domain name...

                s1-ranjan in Content Delivery URL (prefixes files) you're supposed to enter something like https://my-special-other-subdomain.domain.tld. FoF Upload will then build a URL by adding /assets/files/filename.ext after the provided value.

                The value should be a fully qualified domain name. Using relative paths might work but that's not the intended usage.

                  clarkwinkelmann I am not able to figure out what should be the root folder for this new subdomain, as of now the public folder is been used as the root folder of the main domain, and the location of the assets folder is in the public folder, hence should the very same public folder be used as the root folder for the subdomain, if that'll be the situation then it's most likely the website can be served from two different URL i.e., one from the main domain and other from the subdomain.

                  4 days later

                  userb you will have to inquire to Imgur if you have questions about their terms of use.

                  This extensions uses Imgur's default API, and I think you can use either a free or pro API key with it.

                  If you want to send files to an unsupported endpoint, you could create your own adapter and connect it via the local extend.php. This will require a bit of digging since we're lacking documentation on how to create additional adapters, but the code was made to accept customer-provided adapters.

                    clarkwinkelmann if possible than I suggest putting a notice? I'm also not sure whether the img is deleted on imgur side if the post is deleted or a client id is banned.

                      userb at this time FoF Upload does not delete any picture, in any adapter. Including local.

                      What is the notice you suggest adding?

                        clarkwinkelmann whatever you find appropriate to the affect the api is using a noncommercial api and maybe a link to imgur below the imgur image storage settings. just want to notice imgur commercial usage requires using a different api with additional headers so it is not a matter of just registering for commercial usage.

                        I want to change the auto syntax of Imgur image from
                        [upl-image-preview url=//i.imgur.com/ABCDEF.png]

                        to

                        ![](https://i.imgur.com/ABCDEF.png) or [img]https://i.imgur.com/ABCDEF.png[/img] and such.

                        is it possible ?

                          6 days later

                          To use Imgur's API commercially, you must first register your application. Once that's done, you must register with RapidAPI. RapidAPI allows you to choose a pricing plan that fits your needs. From then on, the API endpoint is https://imgur-apiv3.p.rapidapi.com/ which must be used in replace of https://api.imgur.com/. Additionally, you must set a X-Mashape-Key request header with the key obtained from Mashape.

                          Please tell me where to change these parameters so as not to disrupt the extension?

                            MuhammadArslan do you mean it's working now, or do you still see the error after following the linked thread? Check out the browser javascript console for the javascript error that's probably occurring. You might also want to check the <flarum>/storage/logs folder for any relevant error message.

                            Aleram it's not a feature we offer at this point. You'll have to fork the extension or register your own adapter from another extension.

                              clarkwinkelmann sorry it was working after the link thread but I figured out the problem and it has something to do with Shout extension. After installing it, enabling it, clearing flarum cache, site crashes. I have to uninstall shout to get site to work.