2014-04-27, 07:42 PM
Hi there!
I am currently working on a forum for authors. As these guys often share documents as txt, docx and pdf files, I have many open requests to embed such files directly in posts.
Now I looked around a bit and found the excellent Google Docs viewer: https://docs.google.com/viewer.
It renders all common document file formats and has a clean and embeddable UI, you can simply embed an iframe to the file URL in the following syntax:
<iframe seamless="seamless" src="https://docs.google.com/viewer?embedded=true&url=http%3A%2F%2Fresearch.google.com%2Farchive%2Fbigtable-osdi06.pdf" width="100%" height="800px"></iframe>
I tried to understand where the attachment.php is making images show up full size in posts and work out a solution from there but wasn't able to find anything seemingly related to this. Then I created a custom page where I tried to point the iframe to an attachment (like /attachment.php?aid=1") but the viewer just the html document with an access denied error message even though I allowed the download of attachments for the group guest.
Can anybody help me with this? I'd be happy to create a plugin afterwards to embed documents as I think it is pretty useful.
What I need is a snippet of code to create a html object with the attachment link for specific file types and an explanation for the access problem.
Thank you so much in advance
Radiergummi
I am currently working on a forum for authors. As these guys often share documents as txt, docx and pdf files, I have many open requests to embed such files directly in posts.
Now I looked around a bit and found the excellent Google Docs viewer: https://docs.google.com/viewer.
It renders all common document file formats and has a clean and embeddable UI, you can simply embed an iframe to the file URL in the following syntax:
<iframe seamless="seamless" src="https://docs.google.com/viewer?embedded=true&url=http%3A%2F%2Fresearch.google.com%2Farchive%2Fbigtable-osdi06.pdf" width="100%" height="800px"></iframe>
I tried to understand where the attachment.php is making images show up full size in posts and work out a solution from there but wasn't able to find anything seemingly related to this. Then I created a custom page where I tried to point the iframe to an attachment (like /attachment.php?aid=1") but the viewer just the html document with an access denied error message even though I allowed the download of attachments for the group guest.
Can anybody help me with this? I'd be happy to create a plugin afterwards to embed documents as I think it is pretty useful.
What I need is a snippet of code to create a html object with the attachment link for specific file types and an explanation for the access problem.
Thank you so much in advance
Radiergummi