0

Is it possible to display uploaded image files (not File Entities or Image Fields) as images inside a View? When I create a file View I can either choose to format it using fields, which allows me to display the file name etc, or as a rendered entity which does not display anything at all. I would like to be able to display a list of uploaded images via Views, as oppose to a list of file names. Can this be done?

Here is why I am trying to do this. I have CKEditor module enabled and I am using One Click Upload module to allow users to upload image files into their text areas. I have tried using Media and File Entity with CKEditor but they were very unstable and caused a great deal of database errors on my website. I also prefer One Click Upload's minimal interface, as the name of the module implies. The problem of course is that One Click Upload does not use File Entities or File Fields for uploading, which is why I am trying to work out how to format the files in Views to show up as rendered images. Is this possible?

4
  • I don't think that you can select those images via views, since they are embedded into a textarea field (CKEditor). Jun 1, 2014 at 9:17
  • The image files get uploaded into the default files directory, so I can access them in Views. The issue is how to have a .jpg, .png etc file display as an image and not just as a file name. Do I need to rewrite the field output or use some custom format, that is the part I am having trouble with. How do I display a file as an image in Views?
    – FrontEnd
    Jun 1, 2014 at 11:39
  • Views is a query builder and doesn't have a direct access to the files in the file system. It can only access those files/images that attached to a field etc, i.e. those that have a File Id (fid) and are managed in database. The problem with your setup is that your images aren't managed through database so they don't have a file id, so that views cannot know about your images. Jun 1, 2014 at 11:56
  • The files do get saved in the database, I just tried it again and I'm looking at the file in the file_managed table, it is the only one with that name. But that isn't the point of this question, the question is how do you format/display files in a View so that they appear as an image and not as a file name only. I can see these files in my View right now but only their file names, file path etc, but I don't know how to show them as actual images.
    – FrontEnd
    Jun 1, 2014 at 12:27

1 Answer 1

0

Ok I managed to work it out, it is quite simple really; you need to rewrite the output of the field using the html img tag and the replacement patterns available. This will convert any image files uploaded into the website from file names into actual images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.