Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-12 23:52:03

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Previews for files

Textpattern handles previews for images fine.
Sometimes though I wish, there was a way to associate previews also with files for the following reasons:

  1. ability to quickly locate certain files in the backend visually
  2. automatically generating a list of files with thumbs

I’m not suggesting that Textpattern should generate these previews automatically, but a simple ‘upload thumbnail’ like we have for images would be perfectly fine.

Offline

#2 2010-05-13 00:24:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: Previews for files

masa wrote:

I wish, there was a way to associate previews also with files

File images have been on my wish list for a while (heck, why not Link images too so you can present thumbnails of web pages you want to link to?!)

With the new image_list tag and context detection ability in the other ‘list’ tags, perhaps this can come of age sometime soon. But my initial thoughts on this were slightly more simplistic than the version you suggested:

  1. Add an ‘image’ column to the files table
  2. It works in exactly the same way as article_image, namely you put in an ID and it’ll link the file with that TXP image
  3. If a thumbnail is associated with a file, display it in the list view under/near the name and hyperlink it to the File edit screen

That means out of the box you still have to upload images to the Images tab and then link them (just like you do for articles right now), but the advantages of this approach over a full-blown upload facility are:

  • it’s far simpler to implement
  • it keeps the content separation clean
  • it gives plugin authors something to do :-)

So in the same way that lam_image_selector allows you to associate an image directly from the Write tab, there’s no reason a clever plugin author couldn’t offer a similar facility on the Files tab. Or even go a stage further and add the ‘upload thumbnail’ feature you mentioned that would simply insert the chosen image into the txp_image table, associate it with a category/provide alt/caption if you wish, and add its ID to the file’s ‘image’ column in one step.

I have actually done file images once for a client and wrote a tiny plugin that allowed you to visually assign an image from ones already in the Image table to a file. It worked quite well. Displaying a thumbnail in the File list view was a bit clunky, though: it could really benefit from a grid view of files.

So I’m not sure if that’s any consolation, nor if it’s something that should be in the core or not. I often find myself associating images to files using sleight of hand techniques like making the filename of the image the same as the filename of the file and then linking to it if the image exists. File images would make that a whole lot easier for people, but just because I think it’s a good idea doesn’t necessarily mean it’s a good idea for everyone. It could just be bloat and would be better off as an entire plugin; new column and all.

Anybody have views either way on this?

Last edited by Bloke (2010-05-13 00:28:03)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2010-05-13 08:13:57

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Previews for files

Another view but it’s more conceptual – add custom_fields to all types of content (articles, files, imgs, links, …) and you can place anything in this fields. But this question is worth to be discussed in separate topic.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#4 2010-05-13 12:04:54

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Re: Previews for files

the_ghost wrote:

Another view but it’s more conceptual – add custom_fields to all types of content (articles, files, imgs, links, …) and you can place anything in this fields. But this question is worth to be discussed in separate topic.

I was thinking the same thing. This could be incredibly useful and provide endless possibilities for customising Textpattern. The only thing is I’d like to see custom fields removed from the main table and placed in a table of their own, but that is probably for a discussion away from here…

Offline

#5 2010-05-13 12:11:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: Previews for files

monkeyninja wrote:

I’d like to see custom fields removed from the main table and placed in a table of their own

OT: This may come true one day. Hard to say without deep(er) thought. Of course, if you have a patch that won’t break existing sites, you know where we are… ;-)

but that is probably for a discussion away from here…

Yup.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2010-05-19 00:53:52

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Previews for files

Bloke wrote:

[…] But my initial thoughts on this were slightly more simplistic than the version you suggested:

  1. Add an ‘image’ column to the files table
  2. It works in exactly the same way as article_image, namely you put in an ID and it’ll link the file with that TXP image
  3. If a thumbnail is associated with a file, display it in the list view under/near the name and hyperlink it to the File edit screen

That means out of the box you still have to upload images to the Images tab and then link them (just like you do for articles right now), […]

Thanks for your thoughts, Stef.

Even though I would prefer not to clutter the Images tab with file previews, your suggested solution sounds perfectly adequate, especially since it’s easier to implement.

Offline

Board footer

Powered by FluxBB