Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Scribd Document Viewer Plugin  (Read 28719 times)

0 Members and 1 Guest are viewing this topic.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Scribd Document Viewer Plugin
« on: August 13, 2008, 02:37:39 pm »

You have quite a few documents (txt, doc, pdf etc..) in your gallery? and you want to display them in a better way? If yes then this is the plugin for you.

For those of you who are not familiar with Scribd, take a look at this. This is how you can display the documents in your coppermine installation too. Here is a working demo after installing the plugin.

First you will have to register an account on Scribd and get the API key and secret phrase. You can do so from here.

After you get the API key and secret phrase install the attached plugin and your are all done.

Unfortunately cpg lacks a few plugin hooks which is needed by this plugin, So you will have to add those hooks manually i.e. you will have to add a few lines of code manually before installing the plugin.

Edit include/picmgmt.inc.php (function add_picture)
Add

Code: [Select]
    $CURRENT_PIC_DATA['pid'] = mysql_insert_id();
    CPGPluginAPI::filter('add_file_data_success',$CURRENT_PIC_DATA);

just before

Code: [Select]
    return $result;
}

Edit delete.php (function delete_picture)
Add

Code: [Select]
    $pic['pid'] = $pid;
    CPGPluginAPI::filter('before_delete_file', $pic);

just before

Code: [Select]
    $query = "DELETE FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' LIMIT 1";
    $result = cpg_db_query($query);

Edit editpics.php (function process_post_data)

Add

Code: [Select]
       $pic['pid'] = $pid;
       CPGPluginAPI::filter('before_delete_file', $pic);

just before

Code: [Select]
                        $query = "DELETE FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' LIMIT 1";
                        $result = cpg_db_query($query);

Thats it. After making the above changes you can install the plugin. The configure screen of plugin will ask you the Scribd API key and Secret phrase.

Supported formats are txt, doc, ppt, xls, pdf and rtf

Note:
  • The plugin requires PHP 5 and CURL
  • Only documents uploaded after installing the plugin will be converted to Sribd. All older documents will continue to be displayed in normal way.
  • All the documents you upload to your cpg installation will also be copied to scribd server.
  • After you uninstall the plugin, the copies from scribd server will not get deleted. You will have to do that manually by visiting their site.

Cheers,
Abbas
« Last Edit: August 13, 2008, 04:50:16 pm by Abbas Ali »
Logged
Chief Geek at Ranium Systems

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Scribd Document Viewer Plugin
« Reply #1 on: August 13, 2008, 11:05:44 pm »

Wow, that's cool. Are you going to add the "missing" hooks to cpg1.5.x, so it can be used with that version easily?
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Scribd Document Viewer Plugin
« Reply #2 on: August 14, 2008, 06:45:47 am »

Yes i will. Actually i was thinking to add them in cpg14x as well. Perhaps i will create a separate thread to discuss this.
Logged
Chief Geek at Ranium Systems

valsg

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Scribd Document Viewer Plugin
« Reply #3 on: April 08, 2009, 07:35:54 pm »

Indeed this is a great plugin :) I am however experiencing a strange issue with it. The plugin itself is working wonderfully alone but as soon as a bridge is installed, any newly uploaded file is not processed by it but instead is displayed regularly. I first noticed this after installing the phpBB3 bridge and thought this might be because of the bridge itself thus had it uninstalled. Once uninstalled, scribd plugin started working fine again and processed newly uploaded files correctly. I have then installed the SMF bridge and again, scribd plugin stopped processing new files.

Am I missing something and is there any way I can make the plugin work with either phpBB3 or SMF bridged? I guess this might be due to the custom hooks that I had to add to the files as described in th post above, but since I don't really know the code that well, I can't determine what might be causing it. Any help on that topic will be appreciated.

Thank you in advance!
Logged

Myles

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Scribd Document Viewer Plugin
« Reply #4 on: April 22, 2009, 02:55:37 pm »

I have the same problem as in the above post.
The plugin works perfectly, but when I enable my bridge with phpbb3 the plugin is disabled. I have also bridged with SMF and the same thing happened. I'd be grateful if someone else would try it too.
Here is the site (the bridges are currently disabled so that I can make use of the plugin):

www.isbcreative.org 


For info: it's a school site and we are aiming for students to be able to upload their work to the gallery and also discuss it in a bridged forum. Ideally, I'd also like to include a bridge with b2evolution, which would create something quite special. So any help with this will be much appreciated.
Logged

Nibbler

  • Guest
Re: Scribd Document Viewer Plugin
« Reply #5 on: April 22, 2009, 03:15:07 pm »

Edit codebase.php, find

Code: [Select]
// We will only consider those extenstions which are supported by Scribd
global $scribd_valid_extensions;
$scribd_valid_extensions = array('pdf', 'txt', 'rtf', 'ppt', 'doc', 'xls');

Change to

Code: [Select]
// Add page_start action
$thisplugin->add_action('page_start', 'scribd_init');

function scribd_init()
{
    // We will only consider those extenstions which are supported by Scribd
    global $scribd_valid_extensions;
    $scribd_valid_extensions = array('pdf', 'txt', 'rtf', 'ppt', 'doc', 'xls');
}

That's the only thing I can see that might be an issue when bridging.
Logged

Myles

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Scribd Document Viewer Plugin
« Reply #6 on: April 26, 2009, 04:48:49 am »

Thanks for your help. I have tried that, but the problem remains. (Each time I enable the smf bridge the plugin stops working.)

This is a copy of my codebase.php file as it is now http://www.isbcreative.org/test/codebase.txt


Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 21 queries.