Here is my take on adding bbcode to displayimage.php. The core code I got from here (http://forum.coppermine-gallery.net/index.php?topic=3552.0)
Tested with: CPG Version 1.4.10, IE 6, IE 7 (I also had an earilier version running on 1.3.5)
Ease: Easy
My version allows the webmaster to configure how he/she would like the links displayed. The options are 'buttons', 'text', 'textarea' and 'textbox'.
See the screen shots below for a screen shot of each option. Just set the $bbcode_type variable to how you would like the links displayed. Furthermore, if you want to use the textbox or textarea option, set the $bbcode_textboxsize to how wide you want the textbox.
I also added a popup window that the user can copy the bbcode from for compatability. I'm not sure if the copy to clipboad method will work on FF, Netscape, Opera, ...
Also I used the language file so that you can translate it to any language that you wish.
I think this hack lends itself nicely to a plugin but I haven't figured out the plugins yets. ??? If / When I get it pluginized, I'll update this.
Credit needs to go to Chris, our other webmaster, for getting this code started. I modified what he already had and cleaned it up some.
screen shots:
'buttons' | 'text' | 'textarea' | 'textbox' |
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fspadfest.rcspads.com%2Falbums%2Fuserpics%2F10001%2Fthumb_cpg_bbcode_buttons.png&hash=62b38a4d0597475e7c21e9ef7342abe2d50d8014) (http://spadfest.rcspads.com/albums/userpics/10001/cpg_bbcode_buttons.png)
| (https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fspadfest.rcspads.com%2Falbums%2Fuserpics%2F10001%2Fthumb_cpg_bbcode_text.png&hash=421d8f11c8bb1f37682f3b6721477716ff35c656) (http://spadfest.rcspads.com/albums/userpics/10001/cpg_bbcode_text.png)
| (https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fspadfest.rcspads.com%2Falbums%2Fuserpics%2F10001%2Fthumb_cpg_bbcode_textarea.png&hash=10084d78bd1de0ef538f08882e5dad2a12e8edef) (http://spadfest.rcspads.com/albums/userpics/10001/cpg_bbcode_textarea.png)
| (https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fspadfest.rcspads.com%2Falbums%2Fuserpics%2F10001%2Fthumb_cpg_bbcode_textbox.png&hash=d442ed831fe96a88c293b16f6080674b8d7f19a3) (http://spadfest.rcspads.com/albums/userpics/10001/cpg_bbcode_textbox.png)
|
#
#-----[ OPEN ]------------------------------------------
#
displayimage.php
#
#-----[ OPEN ]------------------------------------------
#
displayimage.php
#
#-----[ FIND around line # 172]-------------------------
#
// Create the add to fav link
$ref = $REFERER ? "&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>';
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
/* Start bbCode display options
// ** Configure **
$bbcode_textboxsize = 90;
/************************************************************
$bbcode_type = {type}
"button" will display button links
"text" will display text links
"textarea" will display text box with the bbCode in it
"textbox" will display text in a single line text box
************************************************************/
$bbcode_type = "button";
/* Do not change anything below this line.
unless you know what your doing. */
// Create the BBcode with a link to thumbnail
$bbcodethumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb');
$bbcodefull_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
$bbcodedisplay = '[url=' . $CONFIG["ecards_more_pic_target"] . $bbcodefull_url.'][img]'.$CONFIG["ecards_more_pic_target"].$bbcodethumb_url.'[/img][/url]';
$bbcodecopy_text = "<a href='javascript:;' onclick=\"window.clipboardData.setData('Text','" . $bbcodedisplay . "');\" title='Click here to copy bbCode (IE only)'>" . $lang_picinfo['copy_bbcode'] . "</a>";
$bbcodedisp_text = "<a href='javascript:;' onClick=\"MM_openBrWindow('yourpopupfile.php?bb=" . $bbcodedisplay . "','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=600,height=5');\" title='Click to display bbCode'>" . $lang_picinfo['disp_bbcode'] . "</a>";
$bbcodedisp_textbox = "<small><input class='textinput' type='text' size='$bbcode_textboxsize' value='" . $bbcodedisplay . "'></small>";
$bbcodedisp_textarea = "<small><textarea class='textinput' rows='4' cols='$bbcode_textboxsize'>" . $bbcodedisplay . "</textarea></small>";
$favadd_text = "<a href='addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "'>" . $lang_picinfo['addFav'] . "</a>";
$favrem_text = "<a href='addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "'>" . $lang_picinfo['remFav'] . "</a>";
$bbcodecopy_button = "<button class='button' onclick=\"window.clipboardData.setData('Text','" . $bbcodedisplay . "');\">" . $lang_picinfo['copy_bbcode']; // Copy bbCode to clipboard";
$bbcodedisp_button = "<button class='button' onClick=\"MM_openBrWindow('yourpopupfile.php?bb=" . $bbcodedisplay . "','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=600,height=5')\">" . $lang_picinfo['disp_bbcode'];
$favadd_button = "<button class='button' onclick=\"window.open('addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "','_self');\">" . $lang_picinfo['addFav'] ;
$favrem_button = "<button class='button' onclick=\"window.open('addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "','_self');\">" . $lang_picinfo['remFav'] ;
// * Show the bbCode link in the File Information section
// Create the add to fav link
$ref = $REFERER ? "&ref=$REFERER" : '';
if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
// ** Add to Favorites **
switch ($bbcode_type){
case "button":
// ** Button Method **
$info[$lang_picinfo['copy_bbcode']] = $bbcodecopy_button;
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_button;
$info[$lang_picinfo['addFavPhrase']] = $favadd_button;
break;
case "text":
// ** Text Method **
$info[$lang_picinfo['copy_bbcode']] = $bbcodecopy_text;
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_text;
$info[$lang_picinfo['addFavPhrase']] = $favadd_text;
break;
case "textbox":
$info['Text Box'] = $bbcodedisp_textbox;
$info[$lang_picinfo['addFavPhrase']] = $favadd_text;
break;
default:
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_textarea;
$info[$lang_picinfo['addFavPhrase']] = $favadd_text;
break;
}
} else {
// ** Remove from Favorites **
switch ($bbcode_type){
case "button":
// ** Button Method **
$info[$lang_picinfo['copy_bbcode']] = $bbcodecopy_button;
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_button;
$info[$lang_picinfo['addFavPhrase']] = $favrem_button;
break;
case "text":
// ** Text Method **
$info[$lang_picinfo['copy_bbcode']] = $bbcodecopy_text;
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_text;
$info[$lang_picinfo['addFavPhrase']] = $favrem_text;
break;
case "textbox":
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_textbox;
$info[$lang_picinfo['addFavPhrase']] = $favrem_text;
break;
default:
$info[$lang_picinfo['disp_bbcode']] = $bbcodedisp_textarea;
$info[$lang_picinfo['addFavPhrase'].'2'] = $favrem_text;
}
}
#
#-----[ OPEN ]------------------------------------------
#
lang/english.php
#
#-----[ OPEN ]------------------------------------------
#
lang/english.php
#
#-----[ FIND around line # 1450]------------------------
#
'movie_player' => 'Play the file in your standard application',
#
#-----[ AFTER, ADD ]------------------------------------
#
'copy_bbcode' => 'Copy bbCode to Clipboard',
'disp_bbcode' => 'Display bbCode',
#
#-----[ CREATE ]----------------------------------------
#
yourpopupfile.php
#
#-----[ ADD ]-------------------------------------------
#
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>popup</title>
</head>
<body>
<br>
<table style="margin-left: auto; margin-right: auto; text-align: center; width: 530px; height: 56px;" border="2" cellpadding="10" cellspacing="0">
<tbody>
<tr>
<td rowspan="4" wrap="1" style="width: 75%; vertical-align: middle; height: 50%; text-align: center;">
<?php print $_GET['bb']; ?>
</td>
</tr>
</tbody>
</table>
</body>
</html>
#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
here you can find a bbcode plugin http://forum.coppermine-gallery.net/index.php?topic=36302.0
feel free to modify it to your needs
Is it possible to make the text area that shows a link to the picture larger?