How to display PowerPoint Presentation In Rails 4 Paperclip??/ - ruby-on-rails

In my application, i have uploaded PPT,PPTX files using paperclip gem. I have url like this
" Presentation.last.avatar.url" = "/system/presentations/avatars/000/000/006/original/example.ppt?1411994371"
Now i want to display those PPT, and PPtx files in my localhost web browser. please give me suggestions.. thanks

Assuming you mean that you want them to be embedded in the browser, I've solved this by uploading the them to Scribd in the background and then displaying the embedded widget. This is a great solution because turning a PPT file into clean HTML is hard (so let someone else work it out), and you do not have to pay for hosting or bandwidth for those files.
It's a lot nicer to do it this way than to force the user to have an Office plugin installed for their browser, which depending on their platform they may not have.
The Scribd_fu gem will work with Paperclip, or you could use the official RScribd gem and roll your own.

Related

How to display a .pdf on BrowserField in Blackberry 7

I'm trying to display a .pdf file on a browserfield but somehow it's not opening in my app however it works fine with .txt files.
I'm reading .pdf file from local storage and using
browser_field.displayContent(fileinbytes, "application/pdf", "");
but it's displaying a player like image on the screen and not actual result.
If anyone has any idea about the same, i'm all ears.
As far as I can tell this isn't possible (browserfield doesn't even fully support javascript).
This post suggests that you can view it via Google, which wouldn't be from local storage.
(Un)luckily blackberry is very similar to Java ME, so you can often use those libraries as is. Apparently JPedal can render pdf files for J2ME, and might be worth a look.
Other than that, I don't think you'll have much hope. Good luck

Security issue using Rails, CKEditor, and Roxy fileman

I've been using Ckeditor in my Rails app for a while now, but recently I needed to add the capability to upload html5 videos as well. I added a plugin to CKEditor to utilize the html5 'video' tag, but the generic 'browse server' functionality in CKEditor won't let me upload an mp4 (it just shows the filename as a # sign.)
my solution was to add the Roxy fileman to handle the uploads, and it work great, except there's no security at all in it by default (if the fileman is in a public folder, which is the only way i can see to do it in Rails.)
The only thing Roxy offers is a checkAccess script that gets run before each PHP script gets run, but there's no way for that script to know if the user is logged in or not.
I was thinking I could use x-sendfile to have rails check the permissions, but that seems like using a sledgehammer to hang a picture frame (and it might not even be the right way to do things here.) To me, there should be a simple answer.
Any ideas?

Opening a TIFF File from the Web Browser

I checked previous questions here on SO but I think I want my functionality to work a little different. I understand that .tif files are not natively supported in Internet Explorer and that an extension, such as AlternaTIFF, are available to remedy this. However, I would like the dialog to show up where the user can either save/open the file on the client side. I know that MS Windows Picture and Fax Viewer can open them, no problems.
The files are located on our servers and this will be an intranet site. Currently, I have a link to the files populate in the view but again, I'd like that option for the user to Save/Open the file.
I'm using MVC, which I'm a little unfamiliar with, and can't seem to figure this one out. Thank you.
You can do an action that returns a tiff by changing the headers so when someone clicks the link the file will get downloaded or using FileResult.
Example with FileResult (i find it easier): http://www.dotnetcurry.com/ShowArticle.aspx?ID=807
For saving them is just like uploading any file with MVC. This post can be useful http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
My advice is that you convert them to .jpg or .png when uploaded using GDI+.
//You first upload the tiff to the server like the post above explains
//And then open and convert it to .JPEG
Bitmap bm = Bitmap.FromFile("mypic.tiff");
bm.Save("mypic.jpg",ImageFormat.JPEG);
And if you already have the urls of all the tiffs, you can always do a console app to convert all of them. Even if you need to use tiffs its a good idea to have .jpg versions to show on the web. You can even resize them to create previews and save some bandwith too! :-)

Show files on FTP in a Rails App

We have an FTP site for clients, and they just go to it with a web browser and see the files. I'd like to display the files in a more visually pleasing manner, is there a way I can show what files are on the server in the view, perhaps iterate over them and style them?
I found this answer here, but really didn't answer my question:
Ruby-Rails serve ftp file direct to client
(using rails 3 if it makes a difference)
You can use library links below:
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/net/ftp/rdoc/index.html
http://oreilly.com/catalog/ruby/chapter/ch04.html
and you can use EventMachine https://github.com/schleyfox/em-ftp-client.
Cheers!

Does anyone know of an iPaper alternative?

We would like to display office documents in the browser (DOC, PPT, XLS and PDFs). The iPaper API from Scribd is perfect but ideally it would be installed on our server. Open source is a preference but commercial is ok. Looking for an easy, server side, good looking, minimal interface flash frontend viewer.
Thanks!
You can use Google Document Viewer in embedded mode. It cannot be installed on your server and your documents will have to be accessible from the web.

Resources