forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Hein Traag on November 27, 2006, 07:08:58 pm

Title: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on November 27, 2006, 07:08:58 pm
Guys and Gals from CPG.

I searched but seem to be unable to come up with the right search keywords for finding the mod
once made to open and browse pdf files within CPG.

Can someone point me in the right direction ?

Thanks
Hein
Title: Re: Open PDF from within CPG
Post by: Joachim Müller on November 27, 2006, 07:22:03 pm
Browse pdf files directly in your gallery. (http://forum.coppermine-gallery.net/index.php?topic=16986.0) (Warning: mod has originally been created for cpg1.3.x!)
Title: Re: Open PDF from within CPG
Post by: Hein Traag on November 28, 2006, 12:48:46 pm
Thanks for the link GauGau. Will try to get it going on 1.4.10 , i'll see how far i get  ;D

Hein
Title: Re: Open PDF from within CPG
Post by: Joachim Müller on November 28, 2006, 05:20:06 pm
If you should manage to port it to cpg1.4.x, it would be great if you could post it for the benefit of others. If you decide to do so, please start a new thread (with reference to the old mod) and post your instructions on how to apply the mod in your new thread.
Title: Re: Open PDF from within CPG
Post by: Hein Traag on November 30, 2006, 04:56:41 pm
I tried and tried but got nowhere. The code differs to much from 1.3 , for which it was originally written, for me to make it work.

It is a very handy mod though. Maybe somebody else, Nibbler maybe, can look at getting this to work for 1.4.x ?

Thanks
Hein
Title: Re: Open PDF from within CPG
Post by: Sami on November 30, 2006, 10:55:26 pm
Hein can you try this cause I don't have access to my test bed :

1) open up the scripts.js and add the following at the end of that:
Code: [Select]
pos = 1;

function next(top)
{
pos +=1;
if (pos > top) pos = 1
repoint();
}

function prev(top)
{
pos -=1;
if (pos < 1) pos = top
repoint();
}

function repoint()
{
var picurl = document.getElementById("pdfview").src;
picurl = picurl.replace(/(\d+)\.jpg$/, pos + '.jpg');
document.getElementById("pdfview").src = picurl;
}

2) Open up themes/yourtheme/theme.php and add this function before ?> (php end tag)
Code: [Select]
function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
    global $album, $comment_date_fmt, $template_display_media;
    global $lang_display_image_php, $lang_picinfo;

    $pid = $CURRENT_PIC_DATA['pid'];
    $pic_title = '';

    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) array_shift($USER['liv']);
        array_push($USER['liv'], $pid);
    }

    if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
      $condition = true;
    }else{
     $condition = false;
    }

    if ($CURRENT_PIC_DATA['title'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
    }
    if ($CURRENT_PIC_DATA['caption'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
    }
    if ($CURRENT_PIC_DATA['keywords'] != '') {
        $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
    }

    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_media, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_media, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_media, 'caption');
        }
    }

    $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';

    if ($CONFIG['make_intermediate'] && $condition ) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }

    $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);

    $pic_title = '';
    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);


    if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {

        if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
            $CURRENT_PIC_DATA['pwidth']  = 320; // Default width

            // Set default height; if file is a movie
            if ($mime_content['content']=='movie') {
                $CURRENT_PIC_DATA['pheight'] = 240; // Default height
            }
        }

        $ctrl_offset['mov']=15;
        $ctrl_offset['wmv']=45;
        $ctrl_offset['swf']=0;
        $ctrl_offset['rm']=0;
        $ctrl_offset_default=45;
        $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
        $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
    }

    if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth']+5;  //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
            $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
            $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
            $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
            $pic_html .= "</a>\n";
        } else {
            $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
        }
    // pdf additions begin
    } elseif ($mime_content['mime'] == 'application/pdf'){
        $pic_thumb_url = explode('.', $picture_url);
array_pop($pic_thumb_url);
$baseurl = implode('.', $pic_thumb_url);
$pic_thumb_url = $baseurl . '.1.jpg';

$i = 0;
while (file_exists($baseurl . '.' .++$i.".jpg"));
$i--;

$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img id=\"pdfview\" src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
$pic_html .= '<a href="javascript:;" onclick="prev('.$i.')"><img src="images/prev.gif" width="16" height="16" border="0" /></a> Browse this document <a href="javascript:;" onclick="next('.$i.')"><img src="images/next.gif" width="16" height="16" border="0" /></a><br />';
// pdf additions end
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
        $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
    } else {
        $autostart = ($CONFIG['media_autostart']) ? ('true'):('false');

        $players['WMP'] = array('id' => 'MediaPlayer',
                                'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
                                'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" ',
                                'mime' => 'type="application/x-mplayer2" ',
                               );
        $players['RMP'] = array('id' => 'RealPlayer',
                                'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
                                'codebase' => '',
                                'mime' => 'type="audio/x-pn-realaudio-plugin" '
                               );
        $players['QT']  = array('id' => 'QuickTime',
                                'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
                                'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
                                'mime' => 'type="video/x-quicktime" '
                               );
        $players['SWF'] = array('id' => 'SWFlash',
                                'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
                                'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
                                'mime' => 'type="application/x-shockwave-flash" '
                               );
        $players['UNK'] = array('id' => 'DefaultPlayer',
                                'clsid' => '',
                                'codebase' => '',
                                'mime' => ''
                               );

        if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
            $user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
        } else {
            $user_player = $mime_content['player'];
        }

                // There isn't a player selected or user wants client-side control
        if (!$user_player) {
            $user_player = 'UNK';
        }

        $player = $players[$user_player];

        $pic_html  = '<object id="'.$player['id'].'" '.$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";
    }

    $CURRENT_PIC_DATA['html'] = $pic_html;
    $CURRENT_PIC_DATA['header'] = '';
    $CURRENT_PIC_DATA['footer'] = '';

    $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

    return template_eval($template_display_media, $params);
}

3) Open up include/picmgmt.inc.php and change add_picture function with this one
Code: [Select]
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
{
    global $CONFIG, $ERROR, $USER_DATA, $PIC_NEED_APPROVAL;
    global $lang_errors;

    $image = $CONFIG['fullpath'] . $filepath . $filename;
    $normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename;
    $thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;



    if (!is_known_filetype($image)) {
        return false;
    } elseif (is_image($filename)) {
        $imagesize = getimagesize($image);

        if ($CONFIG['read_iptc_data']) {
           $iptc = get_IPTC($image);
           if (is_array($iptc) && !$title && !$caption && !$keywords) {  //if any of those 3 are filled out we don't want to override them, they may be blank on purpose.
               $title = (isset($iptc['Title'])) ? $iptc['Title'] : $title;
               $caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;
               $keywords = (isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']) : $keywords;
           }
        }

        if (((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1) || (!USER_IS_ADMIN && $CONFIG['auto_resize'] > 0)) && max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) //$CONFIG['auto_resize']==1
        {
          //resize_image($image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $imagesize[0] > $CONFIG['max_upl_width_height'] ? 'wd' : 'ht');
          resize_image($image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $CONFIG['thumb_use']);
          $imagesize = getimagesize($image);
        }
        if (!file_exists($thumb)) {
            if (!resize_image($image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))
                return false;
        }
        if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal)) {
            if (!resize_image($image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))
                return false;
        }
    // pdf additions begin
    } elseif (strtolower(array_pop(explode('.', $filename))) == 'pdf'){
$cmd = "/usr/bin/ghostscript -sDEVICE=jpeg -dNOPAUSE  -dBATCH -sOutputFile='{$CONFIG['fullpath']}edit/pdftmp.$filename.%d.jpg' '$image'";
exec ($cmd, $output, $retval);
if ($retval) die("Error $retval on command '$cmd'");

if ($dh = opendir("{$CONFIG['fullpath']}edit")) {
while (($file = readdir($dh)) !== false) {
if (strpos($file, 'pdftmp') === 0){
$parts = explode('.', $file);
$jpeg = array_pop($parts);
$i = array_pop($parts);
$pdf = array_pop($parts);
array_shift($parts);
$rawname = implode('.', $parts);
$dest = "{$CONFIG['fullpath']}$filepath$rawname.$i.jpg";
$src = "{$CONFIG['fullpath']}edit/$file";
resize_image($src, $dest, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']);
unlink($src);
}
}
$thumbname = "{$CONFIG['fullpath']}$filepath/{$CONFIG['thumb_pfx']}$rawname.jpg";
resize_image("{$CONFIG['fullpath']}$filepath$rawname.1.jpg", $thumbname, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']);
        closedir($dh);
}
   // pdf additions end
    } else {
        $imagesize[0] = $iwidth;
        $imagesize[1] = $iheight;
    }

    $image_filesize = filesize($image);
    $total_filesize = is_image($filename) ? ($image_filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumb)) : ($image_filesize);


    // Test if disk quota exceeded
    if (!GALLERY_ADMIN_MODE && $USER_DATA['group_quota']) {
        $result = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE  {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT + USER_ID) . "'");
        $record = mysql_fetch_array($result);
        $total_space_used = $record[0];
        mysql_free_result($result);

        if ((($total_space_used + $total_filesize)>>10) > $USER_DATA['group_quota'] ) {
            @unlink($image);
            if (is_image($image)) {
                @unlink($normal);
                @unlink($thumb);
            }
            $msg = strtr($lang_errors['quota_exceeded'], array('[quota]' => ($USER_DATA['group_quota']),
                '[space]' => ($total_space_used >> 10)));
            cpg_die(ERROR, $msg, __FILE__, __LINE__);
        }
    }
    // Test if picture requires approval
    if (GALLERY_ADMIN_MODE) {
        $approved = 'YES';
    } elseif (!$USER_DATA['priv_upl_need_approval'] && $category == FIRST_USER_CAT + USER_ID) {
        $approved = 'YES';
    } elseif (!$USER_DATA['pub_upl_need_approval'] && $category < FIRST_USER_CAT) {
        $approved = 'YES';
    } else {
        $approved = 'NO';
    }
    $PIC_NEED_APPROVAL = ($approved == 'NO');
    // User ID is now recorded when in admin mode (casper)
    $user_id = USER_ID;
    $username= USER_NAME;
    // Populate Array to pass to plugins, then to SQL.
    $CURRENT_PIC_DATA['aid'] = $aid;
    $CURRENT_PIC_DATA['filepath'] = $filepath;
    $CURRENT_PIC_DATA['filename'] = $filename;
    $CURRENT_PIC_DATA['filesize'] = $image_filesize;
    $CURRENT_PIC_DATA['total_filesize'] = $total_filesize;
    $CURRENT_PIC_DATA['pwidth'] = $imagesize[0];
    $CURRENT_PIC_DATA['pheight'] = $imagesize[1];
    $CURRENT_PIC_DATA['owner_id'] = $user_id;
    $CURRENT_PIC_DATA['owner_name'] = $username;
    $CURRENT_PIC_DATA['title'] = $title;
    $CURRENT_PIC_DATA['caption'] = $caption;
    $CURRENT_PIC_DATA['keywords'] = $keywords;
    $CURRENT_PIC_DATA['approved'] = $approved;
    $CURRENT_PIC_DATA['user1'] = $user1;
    $CURRENT_PIC_DATA['user2'] = $user2;
    $CURRENT_PIC_DATA['user3'] = $user3;
    $CURRENT_PIC_DATA['user4'] = $user4;
    $CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip;
    $CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip;
    $CURRENT_PIC_DATA['position'] = $position;
    $CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data',$CURRENT_PIC_DATA);

    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
    $result = cpg_db_query($query);

    return $result;
}

Please test it and let me know , I'll Split this post to new thread if it's working ;)
Title: Re: Open PDF from within CPG
Post by: Hein Traag on November 30, 2006, 11:14:58 pm
Thanks Sami but unfortunately  :'(..it did not work.

Thanks for looking at the puzzle though. If you are willing to tackle this puzzle then i am willing to test it.

Hein
Title: Re: Open PDF from within CPG
Post by: Sami on November 30, 2006, 11:36:33 pm
Would you try it again ;)
just apply section 2 again (theme.php) I've change it a bit
Title: Re: Open PDF from within CPG
Post by: Hein Traag on November 30, 2006, 11:48:37 pm
Getting there Sami.

It does not actually browse yet but it does display this

Code: [Select]
            |
Browse this document (with a arrow on the left and right)

See here: http://fototest.scouting.nl/displayimage.php?album=14&pos=0 (http://fototest.scouting.nl/displayimage.php?album=14&pos=0)

This is looking promising  :)

Hein

p.s. not quite yet ;).
Code: [Select]
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in /home/fototest/WWW/plugins/CPGOcat/codebase.php on line 61This came up after editing the files as you suggested.
I rolled back the files so the site works again.
Let me know when you want to try again  ;)
And thanks!
Title: Re: Open PDF from within CPG
Post by: Sami on December 01, 2006, 12:00:12 am
check the path to ghostscript under include/picmgmt.inc.php
Code: [Select]
$cmd = "/usr/bin/ghostscript -sDEVICE=jpeg -dNOPAUSE  -dBATCH -sOutputFile='{$CONFIG['fullpath']}edit/pdftmp.$filename.%d.jpg' '$image'";
also remove var_dump from themes/yourtheme/theme.php
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 01, 2006, 03:07:19 pm
 :-[ Little woops on my side. The server i wanted to implement this mod on does not (yet) have ghostscript installed. Sysadmins are having a pow-wow now to determine if they want to install it.

When they do i will install this again to see if it works or not. Have not yet gotten time to install it on my test site.

Hein

- Ghost script installed now. But my dear Sysadmin forgot to pass me the path ;)
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Bruce on December 02, 2006, 04:32:59 am
I tried this on your gallery and had no problem having my default PDF reader opening your documents.

This was using Firefox 1.5.x and Foxit PDF Reader as default.
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 04, 2006, 09:55:34 am
I tried this on your gallery and had no problem having my default PDF reader opening your documents.

This was using Firefox 1.5.x and Foxit PDF Reader as default.

Bruce, read the thread more carefully. This deals with browsing a pdf file from within CPG without the use of pdf readers such as FoxIt PDF Reader.
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 05, 2006, 08:16:34 am
Sami,

got some testing done on my test bed. When i edit the files according to your post it looks good.. until i want to batch add some pdf files.
I then get nothing at first, it does not add the file to a album. When i then click reload it gives a message that it is has a unexpected $ at line 319.
Code: [Select]
Parse error: parse error, unexpected $ in /home/fototest/WWW/include/picmgmt.inc.php on line 319
Done the editing of the files three times now. Same result. Can you see what is going wrong ?

Hein
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Sami on December 05, 2006, 08:52:34 am
Sure I'll
Can you attache your picmgmt.inc.php to this thread , please
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Joachim Müller on December 05, 2006, 09:20:03 am
This mod appears to be a work in progress (as suggested in the subject) and far from being production-ready. It shouldn't have been moved to the mods section, as only actual working mods are suppossed to reside within this sub-board. Mod-discussion is not suppossed to reside in the mods board. I suggest moving this thread back to the support board where it was started initially and start a new thread with the mod instructions once you have fully figured out how the mod works and when it's ready-for-use. The new thread should then be moved to the mods board and contain a link to the previous discussion (this thread) that lead to the creation of the new mod.

Thanks

Joachim
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 05, 2006, 09:56:37 am
My mistake. Please move as i can't.

Hein
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Sami on December 05, 2006, 10:16:28 am
Moved as suggested
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 05, 2006, 01:03:39 pm
Sure I'll
Can you attache your picmgmt.inc.php to this thread , please


Thanks Sami. File attached.
And sorry for the mixup folks. I had a cold diesel like start that day.

Hein
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Sami on December 05, 2006, 06:29:15 pm
Hein Would you check the new add_picture function (section 3)
I should be more careful with } ;D
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 05, 2006, 10:32:47 pm
Almost there. I think it's the path that ghostscript was installed at by my sysadmin.
It now displays this in FF and a red cross in IE
Code: [Select]
            |
< Browse this document >

At home now with no access to pst file at work. I'll adjust the path to what my sysadmin send me. I thought it was /usr/bin/gs but i guess that's not the case since it does not display  ;D. I'll report back tomorow.

Hein

Little update

i tried uploading and batch adding a new pdf file. Which resulted in this error
Code: [Select]
Error 127 on command '/usr/bin/gs -sDEVICE=jpeg -dNOPAUSE -dBATCH -sOutputFile='albums/edit/pdftmp.dare_auteursrecht.pdf.%d.jpg' 'albums/pdftest/dare_auteursrecht.pdf''I think it's because the gs path is not set correctly. Will try again tomorow.

Thanks Sami for the work so far  ;)
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 07, 2006, 01:49:46 pm
Set the correct path but my sysadmin just now informed me that the gs is outside my path.
But i will test it on a other rig i got setup, hopefully this afternoon.


Error 127 also. What does that error mean ?

Hein
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Sami on December 08, 2006, 05:23:23 am
Hein I'm not familier with GS , I'm just trying to port Nibbler's code from 1.3.x version to 1.4.x

BTW I'll googling for this error ....
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 08, 2006, 01:08:49 pm
Hein I'm not familier with GS , I'm just trying to port Nibbler's code from 1.3.x version to 1.4.x

BTW I'll googling for this error ....

I know and it is much appreciated. I did try to google it but it got too technical for me to get a grip on it.

Hein
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Nibbler on December 08, 2006, 01:52:28 pm
127 indicates you have the path wrong.
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Hein Traag on December 08, 2006, 03:52:02 pm
Good timing Nibbler  :)

Thanks, i'll go talk with my sysadmin.

Thanks
Hein
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: francisr6 on December 29, 2006, 11:41:39 pm
Hi.

I'm new on this topic but really concerned. I did install ghostscript on my server and did put the ghostscript path in picmgmt.inc.php.
(for me the path is : /usr/share/ghostscript/7.07/lib)
I get the "Browse this document (with a arrow on the left and right)" instead of the pdf thumb (as we have in the original demo from nibbler).
This with IE as with Firefox.

So i'm not sure that the real problem is only a ghostscript path issue.
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: Nibbler on December 29, 2006, 11:50:20 pm
It needs to be the path to the ghostscript binary, not a directory of libs.
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: joens-schublade on August 24, 2007, 07:24:49 pm
Is anyone interested in creating a plugin for pdfs?

My idea is to create a plugin, that previews a pdf file inside coppermine, extracts the text elements of that file into the description and simply let you view the file in a pdf-reader.

For more information, see this thread at cpg-contrib.org (http://cpg-contrib.org/board/index.php?topic=404.0).
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: radianation on April 30, 2008, 07:35:03 pm
Guys, I see that you've dealt with error 127, but out of nowhere I'm getting error 139 but only on some files. I can't quite figure it out, and my Google searches are turning up nothing. I can't seem to find the error messages documented for ghostscript either.

Code: [Select]
Error 139 on command '/usr/local/bin/gs -sDEVICE=jpeg -dNOPAUSE -dBATCH -sOutputFile='albums/edit/pdftmp._11_625x10_5_CARDnp14.pdf.%d.jpg' 'albums/batch/4-30-08/316/_11_625x10_5_CARDnp14.pdf''
Title: Re: Open PDF from within CPG - work in progress - 1.4.10
Post by: manikantiashok on July 02, 2008, 02:57:30 pm
Hi,

I am new to the forum. I have CPG 1.4.x on windows using xampp. I am following your posts on the PDF mod. Can you suggest/guide me if this mod can work on windows platform.

Thanks in advance