News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Scribd API integration into SMF

Started by ccraciun, January 02, 2009, 05:17:17 AM

Previous topic - Next topic

ccraciun

Hello!

As the title describes i am interested in embedding scribd documents into SMF messages; i already tried the embed code provided by scribd (example), but it dosn't work because it's designed for HTML.
I have an API account (key, secret & publisher ID), i found the PHP client library, but i don't know how to use them because i don't have too much programming skills; searching for this, i found some information, but it's in spanish and i don't know spanish either. :) (... some may say i don't know nothing, but i know electronics..  ;D
The result i hope to achieve by integrating Scribd API in SMF, is intended to be like as inAEVA.

Can anyone give me a clue regarding what should i modify, or what to change in order to try this?

Many thanks

ccraciun

#1
I tried to modify the index.template.php for my theme using some script found here , but it doesn't work...
The result:

H

Any of the code you've inserted with quotes needs to be changed. So ' will become \'
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

ccraciun

Quote from: H on January 02, 2009, 07:20:24 AM
Any of the code you've inserted with quotes needs to be changed. So ' will become \'
Thanks a lot!
It works, but there are some problems with the script; it appears that large documents failed to convert automatically to iPaper.

H

Are you getting Scribd documents that already exist or are you trying to upload attachments and get ipaper versions of them?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

ccraciun

#5
The script actually automatically convert to iPaper any compatible format that already exists somewhere; i guess the conversion is made in real time, because i only put the url with *.pdf in the message content and i get the iPaper version directly on the resulted page.
I will get back with more info, i think i made something wrong and that's why i had problems...



ccraciun

#6
Sorry for the late reply; you can see how it looks: here or here.

The code:
<script type="text/javascript">
    var scribd_publisher_id = \'YOUR PUBLISHER ID FROM SCRIBD\';
    var scribd_type = 2;
    var scribd_keep_original_link = 0;
    var scribd_ipaper_params = [];
    scribd_ipaper_params[\'height\'] = 650;
    scribd_ipaper_params[\'width\'] = 740;
    scribd_ipaper_params[\'public\'] = true;
</script>
<script src="http://www.scribd.com/javascripts/auto.js"></script>

can be entered in index.template.php of your theme, right before the </body> tag.

It is NOT RECOMMENDED for large documents as they are downloading for each user that is opening the topic (and this after uploading from source to scribd server)! So be aware if you have naughty members. ;)

Meanwhile i realized that this is the wrong area for this request, because this does not belongs to features of SMF; i'm sorry about this... if someone can move it to the proper area, it's ok.  When i created the topic i didn't realize that...  O:)

H

I didn't realise either, till you mentioned it :P. In coding discussion now.

Will you be packaging this as a mod? Might be helpful to some users
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

ccraciun

Quote from: H on January 03, 2009, 06:42:13 PM
Will you be packaging this as a mod? Might be helpful to some users
I asked scribd if they allow me to do that because the script belong to them; i didn't found any terms related to the subject and i prefer to wait for their answer. The only credit that i have is for having the idea, searching for a solution and tested it.

Until then, anyone interested in embedding documents as i did, may sign up for a free account at http://www.scribd.com, replace YOUR PUBLISHER ID FROM SCRIBD from the script with the ID received after signing up and add the script to index.template.php file of the active theme.

I used height=650 and width=740 because i use DilberMC with a fixed width of 960px, but these settings may be changed as preffered.

WWWobbly

#9
Hi folks,

Note this is a fairly easy "mainstream" fix, so it may not sit well in the coders area anymore, but it seemed to be the most appropriate place as there is very little info returned when searching about it.

I have been looking around for a solution to this. Not much has been done. But I absolutely had to have the ability to embed Scribd docs into FORUM posts, so I worked on it for two nights.

The solution was staring me in the face. "Embed flash into posts" must be enabled. At this time of writing, in SMF 2.0 RC4, you'll find the admin option to enable it in Forum -> Posts and Topics -> Posts Settings.

Then take the Standard HTML embed code from Scribd for the document you wish to embed and paste it into a new message. But all those lines of code still won't work. What you have to do is slice away 95% of it to leave a single line which you then enclose in SMF's "Insert Flash" code.

The line you are looking for is almost at the very end of the embed code and encapsulates everything required to reference the Scribd document. As an example you look for something like this:

http://d1.scribdassets.com/ScribdViewer.swf?document_id=46184187&access_key=key-244g2w5dnga7hlnwixp3&page=1&viewMode=list

It will be between inverted commas. Select and copy the code similar to above, then delete everything. Paste that line back into the body of your message, select it, then click the "Insert Flash" button. The default width,height [200,200] should be changed to something larger like 625,900.

Click Preview and all going well, you should see the document load. It will take some time initially to fetch the document from Scribd.

Note you don't need Aeva Media to perform this. It's all within SMF. There is a tentative claim within Aeva 1.4c that it supports Scribd but it actually doesn't, although the check box to enable it is there, Aeva blame Scribd for Aeva's broken support.

Advertisement: