• 3 followers

Add an image field to the Files module. How?

The Articles module has the ability to add a simple image for each article. How would I do this with the Files module? Do I need to add a new Block in "Pages"? Or is this a new Field only. Which Field type would I use for a single image (jpg, png). "File"?

This new image field should appear in the Add File, Edit, and View pages of the Files Module, of course.

Well, I am getting nowhere and am at the mercy of people smarter than myself...

Thank you in advance.

  • 80
  • The Files module does have a Preview feature for some types of files. But, in my opinion and for my purposes, it is not very user friendly. Even pdf files as small as 10 megs get a warning message (apparently from Google, a rip-off company which I really cannot stand. Haha.) which says: "Oooops - too big for a preview."

    Video and Sound files have no preview at all and the user gets an unfriendly message which states: "Preview not available."

    I just need to be able to add a single image before the text or the video or the sound file. This is the usual and universal convention used in billions of blog posts and web sites across the internet.

    • Hello Canine!

      File fields are different from the other fields as they require to have the processing of uploaded info. So the similar changes better to make via editing the form file (in your case this is the modules/boonex/files/classes/BxFilesFormUpload.php). Also, it will require the showing of this processed pic too.  All these points require some programming skill (and the learning of this part from our manual https://github.com/unaio/una/wiki/Dev-Forms). But in your task, it would be easier just to upload the preview file too - then you will get 2 files with the same name which may be marked as "the files from the one pack". Or you may use the Space app - where every uploaded package will have the own items: the main file as package, the second - as preview etc


      • Hello Leonid, I find the file module very well, just that it just misses something. I find that Canine Domesticus rightly, this message "Preview not available." gives the impression of a bug.

        For the preview, I do not understand that it does not work properly, it's only an icon depending on the extension, I think we're asking for nothing more than that, and an attached image for illustrate and / or a cover.

        Why not do it like downloading an article in market, (of course without the market-specific part), that would be great like that.

        • Leonid, I am afraid that Spaces has too high of a learning curve for some of our users. Me, for example.

          Yes, to upload an additional preview file (with no processing necessary) is exactly what we need to do! Can you please explain how to add this new preview image field? And also tell us where these preview files will be stored.

          What size of a image file would you recommend? That is, the height and width in pixels. Landscape or portrait?

          On our site, only moderators can upload files which have been approved. Therefore uploading an extra preview file is no problem at all. 

          Thank you for considering this matter, Leonid. I believe others may also be interested in your simple solution. As time goes by.

          • But in your task, it would be easier just to upload the preview file too - then you will get 2 files with the same name which may be marked as "the files from the one pack".

            Attention Leonid! Can you explain how I can implement this change? And to upload the preview image in the Files app. 

            Much, much thanks to YOU!

            • Canine Domesticus I would suggest to try to use Posts module for your purposes, it can be easily changed to allow to upload any files and there is thumbnail/cover.

              Baloo I think we can do it this way - https://github.com/unaio/una/issues/1384

              • Great idea, Alex T! 

                In the Posts, how do you add an upload field? One which will include video, mp3, and pdf files...

                • Upload field can't be added via page builder, it requires custom coding.

                  • To allow to upload any files in Posts module, run the following query:

                    UPDATE  `sys_objects_storage` SET  `ext_allow` =  '', `ext_deny` =  'exe,bat' WHERE  `object` = 'bx_posts_files';
                    • Thanks for this. My CPanel wasn't saying it ran successfully so I just added exe,bat in ext_deny manually in the db.

                      5
                      1
                      1
                      1
                      3
                      Added:
                      Category: