Document preview

Hi,

With images we can give the user the thumbnail to see if thats the image
they are interested in. Is there anything similar around where you
could give the user a preview of a file within the web page? Rails or
web specific?

Ive searched around but cant really find anything,

JB

John Butler wrote in post #972859:

Hi,

With images we can give the user the thumbnail to see if thats the image
they are interested in. Is there anything similar around where you
could give the user a preview of a file within the web page? Rails or
web specific?

Uh, what? Please explain your use case a bit more clearly. In any
case, this is almost certainly a JavaScript issue and will have nothing
to do with Rails.

Ive searched around but cant really find anything,

JB

Best,

sorry for the poor explanation.

If you have a webpage with a list of documents, when the user clicks a
document then it will show them the first page of this document in a pop
up window or in some type of window within the web page via ajax or
something.

These files are rather large and a user may want to see the first
page/contents before deciding to download the entire document.

I was wondering if there were any rails/web/js solutions for this or
something similar...

JB

Please quote when replying.

John Butler wrote in post #972862:

sorry for the poor explanation.

If you have a webpage with a list of documents, when the user clicks a
document then it will show them the first page of this document in a pop
up window or in some type of window within the web page via ajax or
something.

What kind of documents?

These files are rather large and a user may want to see the first
page/contents before deciding to download the entire document.

I was wondering if there were any rails/web/js solutions for this or
something similar...

JavaScript solutions exist. Try a Web search.

JB

Best,

JavaScript can *show* the preview in a nice popup or overlay, true, but I think the issue here is how do you get the preview in the first place. It sounds like the OP wants to make something like Mac OS's QuickLook here...

John, do you have a (hopefully) short list of document types that you need to handle? Are you storing these files using Paperclip or similar? I'm thinking that you could use Paperclip's Processors setup to generate these preview files when they're uploaded, and access them that way. But you'll need to engineer a mechanism for grabbing the first page or whatever from each different file-type you plan to store, along with a fall-back generic curled-page icon for those you can't untwist.

Walter

Walter Davis wrote in post #972866:

These files are rather large and a user may want to see the first
page/contents before deciding to download the entire document.

I was wondering if there were any rails/web/js solutions for this or
something similar...

JavaScript solutions exist. Try a Web search.

JavaScript can *show* the preview in a nice popup or overlay, true,
but I think the issue here is how do you get the preview in the first
place. It sounds like the OP wants to make something like Mac OS's
QuickLook here...

John, do you have a (hopefully) short list of document types that you
need to handle? Are you storing these files using Paperclip or
similar? I'm thinking that you could use Paperclip's Processors setup
to generate these preview files when they're uploaded, and access them
that way. But you'll need to engineer a mechanism for grabbing the
first page or whatever from each different file-type you plan to
store, along with a fall-back generic curled-page icon for those you
can't untwist.

Walter

They are a mixture of documents, mainly graphics and pdfs but maybe
others. Its a system i have inherited using rails 1.2.2. Uses file
column to upload the attachments.

I could add a way to get a preview for new files uploaded and store with
the attachment i suppose, images a straight forward to generate
thumbnail. I could run a task to do the same for the existing documents
or do them as and when.

Im looking around the web to see whats out there but it will come down
to the usual, time and money. I just posted to see what others were
doing and was there anything rails specific around.

thanks for your help,

JB

Walter Davis wrote in post #972866:

JavaScript can only request an image and show it (often using some groovy effect to make it shinier); it can't process the image data and provide a thumbnail or something like that.

To get that, you'd need something server-side to do the heavy lifting like Rmagick or some other image processing library, and you'd need a controller to interpret the image request, decide if the file already had been processed, do the processing and cache it if not, and then serve it. Quite a bit out of the usual realm for JS, right in the zone for Rails and one of its many add-ons.

If I were building this from scratch, I'd be looking at Paperclip, because that has all the hooks for making thumbnails and resized images already baked in, plus a very nice system for extending the thumbnail process to other types of files. I've built a system that scrapes all the text out of a PDF and saves it in a column in the database so I can do "full text" search within PDF attachments. Considering I built that as part of my very first paying Rails gig, I happen to think that Paperclip is *very* accessible that way...

Walter