forum.coppermine-gallery.net

No Support => Feature requests => Topic started by: Bruz on February 27, 2004, 10:58:16 am

Title: [Mod] Discuss-this-picture for CPG and phpbb
Post by: Bruz on February 27, 2004, 10:58:16 am
This is a mod for coppermine and phpbb.
It creates a new link when viewing a picture which starts a new thread in phpbb with the image-filename as title and the image-link in [img]-Tags as message. Now the user which clicked the link can add his suggestions under the image.

First you need to do a few changes to your phpbb.

open posting.php

find
Code: [Select]
if ( $mode == 'newtopic' )
   {
      $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';

      $username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
      $poll_title = '';
      $poll_length = '';
      $subject = '';
      $message = '';
   }


replace with
Code: [Select]
if ( $mode == 'newtopic' )
        {
                $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';

                $username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
                $poll_title = '';
                $poll_length = '';
                $subject = ( !empty($HTTP_GET_VARS['subject']) ) ? htmlspecialchars(trim($HTTP_GET_VARS['subject'])) : '';
                $message = ( !empty($HTTP_GET_VARS['message']) ) ? htmlspecialchars(trim($HTTP_GET_VARS['message'])) : '';
        }


save and upload the file.

Now coppermine:

open displayimage.php

find
Code: [Select]
   $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);

after, add
Code: [Select]
  // Create the 'Discuss-this-Picture function
    $picture_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
    $discuss_name = htmlspecialchars($CURRENT_PIC_DATA['filename']);
    $discuss = "http://www.path_to_your_phpbbforum/posting.php?mode=newtopic&f=[insert the number of the forum where you want to add the Posting without the "[]"]&subject=$discuss_name&message=[img]http://www.path_to_your_album/$picture_path&#91/img]";


find
Code: [Select]
       '{NEXT_TITLE}' => $next_title,

after, add

Code: [Select]
       '{DISCUSS_TGT}' => $discuss,

open /your_theme/theme.php (changes for 'fruity', search '// HTML template for the image navigation bar' in your theme and add what you need to call '{DISCUSS_TGT}')

find
Code: [Select]
<td align="center" valign="middle" class="navmenu" witdh="100%">
                        {PIC_POS}
                </td>


after, add
Code: [Select]
               <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{DISCUSS_TGT}" title="Discuss this picture"><img src="themes/fruity/images/discuss.gif" width="17" height="17" border="0" align="absmiddle" alt="Discuss this picture"></a>
                </td>

(You need to store a picture called 'discuss.gif' in the /images dir of your theme)

Save all files and upload them. You're done.

Please tell me your thougts about this mod in this thread.
Title: [Mod] Discuss-this-picture for CPG and phpbb
Post by: Casper on February 27, 2004, 12:01:49 pm
Hi Bruz,

glad you got it done  :wink:
Title: [Mod] Discuss-this-picture for CPG and phpbb
Post by: Bruz on February 27, 2004, 12:21:36 pm
Thank you casper!

A small addition for those of you who use the 'standart theme':

open theme.php

find
Code: [Select]
<td align="center" valign="middle" class="navmenu" witdh="100%">
                        {PIC_POS}
                </td>


after, add
Code: [Select]
               <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{DISCUSS_TGT}" title="Discuss this picture"><img src="themes/default/images/discuss.gif" width="16" height="16" border="0" align="absmiddle" alt="Discuss this picture"></a>
                </td>


save and upload the file.
Title: [Mod] Discuss-this-picture for CPG and phpbb
Post by: Bruz on February 27, 2004, 08:08:20 pm
And a addition for those who will use the intermediate picture with a link to the big one (creates nice ubb-Code in your Forum)

instead of using the "//Create the 'Discuss-this-Picture function" from above use:
Code: [Select]
  // Create the 'Discuss-this-Picture function
           if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $picture_path = get_pic_url($CURRENT_PIC_DATA, 'normal');
        } else {
        $picture_path = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
        }
        $picture_path_full = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
    $discuss_name = htmlspecialchars($CURRENT_PIC_DATA['filename']);
    $discuss = "http://www.path_to_your_phpbbforum/posting.php?mode=newtopic&f=[insert the number of the forum where you want to add the Posting without the "[]"]&subject=$discuss_name&message=[url=http://www.path_to_your_album/$picture_path_full][img]http://www.path_to_your_album/$picture_path&#91/img][/url]";


If your album contains files with " "'s in the filename you may need to use the "urlencode"-funktion.
Ask me if you have problems.