Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Simple MOD] Create BB Codes for posting images in a forum.  (Read 12830 times)

0 Members and 1 Guest are viewing this topic.

NicMason.com

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
[Simple MOD] Create BB Codes for posting images in a forum.
« on: October 28, 2008, 03:36:24 am »

Credit to the JoomGallery creators for the idea.

Have translated this to CPG and added a couple of additional options.  Support is not available for this simple mod.

Cosmetic adjustments may be necessary depending on your template,  of course.

Enjoy! :D

NicMason.com


Files to edit:
english.php (or your local language file)
displayimage.php

In english.php look for:
Code: [Select]
  'URL' => 'URL', //cpg1.4
After, add:
Code: [Select]
  'BB_TITLE' => '<br /><b style="color:#757575">Forum BB Code</b>&nbsp;&nbsp;(Copy & paste into forum)', //cpg1.4 - NicMason.com
  'BB_LINK' => 'Simple link to this page', //cpg1.4 - NicMason.com
  'BB_THUMB' => 'Insert linked thumbnail', //cpg1.4 - NicMason.com
  'BB_INSERT' => 'Insert full image', //cpg1.4 - NicMason.com
  'BB_FULLLINK' => 'Insert linked full image', //cpg1.4 - NicMason.com


In displayimage.php look for:
Code: [Select]
    $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
After, add:
Code: [Select]
$bb_pic_link = '[URL]' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '[/URL]';  // NicMason.com

$bb_thumb_link = '[URL=' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . ']' . '[IMG]' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . 'thumb_' . $CURRENT_PIC_DATA['filename'] . '[/IMG]' . '[/URL]';  // NicMason.com

$bb_pic_insert = '[IMG]' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '[/IMG]';  // NicMason.com

$bb_full_link = '[URL=' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . ']' . '[IMG]' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '[/IMG]' . '[/URL]';  // NicMason.com


Then look for:
Code: [Select]
    // Create the add to fav link
        $ref = $REFERER ? "&amp;ref=$REFERER" : '';
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" >" . $lang_picinfo['remFav'] . '</a>';
    }

After, add:
Code: [Select]
    // "BB Codes for Forum (copy & paste)" TITLE - NicMason.com
    $info[$lang_picinfo['BB_TITLE']] = '&nbsp;';


    // "Simple Link to This Page" for Forum - NicMason.com
    $info[$lang_picinfo['BB_LINK']] = '<input size="50" value="' . $bb_pic_link . '" readonly="readonly" onClick="select()" type="text">';

    // "Insert Linked Thumbnail" for Forum - NicMason.com
    $info[$lang_picinfo['BB_THUMB']] = '<input size="50" value="' . $bb_thumb_link . '" readonly="readonly" onClick="select()" type="text">';

    // "Insert Full Image" for Forum - NicMason.com
    $info[$lang_picinfo['BB_INSERT']] = '<input size="50" value="' . $bb_pic_insert . '" readonly="readonly" onClick="select()" type="text">';

    // "Insert Full Linked Image" for Forum - NicMason.com
    $info[$lang_picinfo['BB_FULLLINK']] = '<input size="50" value="' . $bb_full_link . '" readonly="readonly" onClick="select()" type="text">';

NicMason.com
Logged

VaporDesigns

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
    • Vapor Designs
Re: [Simple MOD] Create BB Codes for posting images in a forum.
« Reply #1 on: January 07, 2009, 06:19:10 pm »

So this will add direct url coding under the images? Similar to "photobucket"?
Logged

NicMason.com

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: [Simple MOD] Create BB Codes for posting images in a forum.
« Reply #2 on: January 08, 2009, 02:30:53 pm »

Short answer: Yes. :)

I haven't used Photobucket,  but I think it's similar if not the same.
Logged

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 152
    • DJ-Daz
Re: [Simple MOD] Create BB Codes for posting images in a forum.
« Reply #3 on: January 08, 2009, 07:26:01 pm »

sorry to demean your work already NicMason, but there is an eve easier way to do it.

http://forum.coppermine-gallery.net/index.php/topic,46121.0.html

It might not look the same as yours, but it's easier to install.
Logged
https://dj-daz.com
DJ tutorials

NicMason.com

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: [Simple MOD] Create BB Codes for posting images in a forum.
« Reply #4 on: January 08, 2009, 08:52:19 pm »

Don't feel bad.  My snippet of code doesn't feel demeaned at all. :)  Good work with the plugin.
Logged
Pages: [1]   Go Up
 

Page created in 0.121 seconds with 20 queries.