[Simple MOD] Create BB Codes for posting images in a forum. [Simple MOD] Create BB Codes for posting images in a forum.
 

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

Main Menu

[Simple MOD] Create BB Codes for posting images in a forum.

Started by NicMason.com, October 28, 2008, 03:36:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NicMason.com

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:
  'URL' => 'URL', //cpg1.4

After, add:
  '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:
    $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];

After, add:
$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:
    // 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:
    // "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

VaporDesigns

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

NicMason.com

Short answer: Yes. :)

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

Deus

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.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

NicMason.com

Don't feel bad.  My snippet of code doesn't feel demeaned at all. :)  Good work with the plugin.