copy/ paste bbcode img URL below intermediate image - Page 8 copy/ paste bbcode img URL below intermediate image - Page 8
 

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]

Main Menu

copy/ paste bbcode img URL below intermediate image

Started by Stramm, September 16, 2006, 07:16:10 PM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

DonRN

I have been working on this script and have read every post here, but am still having some problems. I almost have it set up the way I'd like, but need a bit of help with some final coding issues

You can find a current example http://www.lifeinmybackyard.com/photoalbums/displayimage.php?album=2&pos=0

The code I am using has been modified using some of the many suggestions and examples on this thread. As you can see, the copy buttons are gone and the copy code is wrong. Is there any way to maintain this appearance and fix these to items?

I'm sure it is an easy fix for someone with the right knowledge.

Thanks in advance,
DonRN

<?php
/**************************************************
  CPG BB Code Plugin for Coppermine Photo Gallery
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.9
  BB Code Plugin version: 1.2
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/


if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Add a filter
$thisplugin->add_filter('file_data','bbcode_add_data');


function 
bbcode_add_data($pic_data){ //$pic_data
global $CONFIG;
if(!
USER_ID) return $pic_data;

//here we define a var that holds the copy to clipboard javascript 
//unfortunately the Firefox security settings do not allow clipboard copy to work without modifying prefs... 
//therefore only a msg pops up if a user uses netscape/ firefox and presses the copy button
$script_data = <<< EOT

<script language="javascript" type="text/javascript">
<!--
function copy_clip(bb_text)
{
 if (window.clipboardData) 
   {
    window.clipboardData.setData("Text", bb_text);
   }
   else if (window.netscape) 
   { 
    alert("Due to Firefox secutrity settings it is not possible to use the copy button. Please manually copy the bb code with 3 fast left clicks into the textara. Then press ctrl+c");
   }
   return false;
}
//-->
</script>
EOT;

$fullsize_url get_pic_url($pic_data);  //here we grab the url to the fullsized pic
$thumb_url get_pic_url($pic_data'thumb'); //thumb url

$pic_data['title'] ? $name $pic_data['title'] : $name 'No Title'//chcking if the pic has a title, if not we set it to 'No title'

//here we define the actual bbcode coppermine path + the path to the pic $img_url is for the version that displays the thumb, $name_url is for a txt link with the ikmage title
$img_url '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.'][IMG]'.$CONFIG['ecards_more_pic_target'].$thumb_url.'[/IMG][/url]';
$name_url '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.']'.$name.'[/url]';
$img_dir_url $CONFIG['ecards_more_pic_target'].$fullsize_url;
$img_dir_url_forum '[IMG]'.$CONFIG['ecards_more_pic_target'].$fullsize_url.'[/IMG]';

//this just brings everything in form... we create a table etc.
$bbcode_data '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '<td><label for="ftl">Thumbnail for forums:</label><input type="text" id="ftl" value=\''.$img_url.'></td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="50" style="overflow:off;">'.$img_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_url.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td><label for="ff">Fullsize for forums:</label><input type="text" id="ff" value=\''.$img_dir_url_forum.'></td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="3" cols="50">'.$name_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$name_url.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td><label for="idl">Direct link to image:</label><input type="text" id="idl" value=\''.$img_dir_url.'></td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="3" cols="50">'.$img_dir_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_dir_url.'")\'></td>';
$bbcode_data .= '</tr></table>';

//finally we add the created stuff to the picture data and return it to coppermine
$pic_data['html'] = $pic_data['html'].$bbcode_data

return $pic_data
}
?>



DonRN

Okay, I have continued to work on this while awaiting a response, which is no problem as I see it as time for me to learn a bit more about the coding.

Anyway, I have managed to get it almost the way I would like but still have one problem as illustrated by the attached image. The problem area is outlined in red. The copy button works properly, but the complete information that should appear in the text area doesn't show. I'm sure it's a coding issue caused by my limited knowledge, but would like to fix it so it displays properly. I have also attached a zip of the file as it is loaded on my site for you to look at.

This plugin is exactly what I have been looking for so any help at all to get it to display properly would be greatly appreciated.

Thanks,
DonRN

Stramm

From the first view I just can see that you do not close the value attribute properly

Should look eg. similar to
value=\''.$img_dir_url_forum.'\'>

DonRN

Making that change gave me a parse error.

Any other suggestions?

Please and Thank You

DonRN

With this code:

<?php
/**************************************************
  CPG BB Code Plugin for Coppermine Photo Gallery
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.9
  BB Code Plugin version: 1.2
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/


if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Add a filter
$thisplugin->add_filter('file_data','bbcode_add_data');


function 
bbcode_add_data($pic_data){ //$pic_data
global $CONFIG;
if(!
USER_ID) return $pic_data;

//here we define a var that holds the copy to clipboard javascript 
//unfortunately the Firefox security settings do not allow clipboard copy to work without modifying prefs... 
//therefore only a msg pops up if a user uses netscape/ firefox and presses the copy button
$script_data = <<< EOT

<script language="javascript" type="text/javascript">
<!--
function copy_clip(bb_text)
{
 if (window.clipboardData) 
   {
    window.clipboardData.setData("Text", bb_text);
   }
   else if (window.netscape) 
   { 
    alert("Due to Firefox secutrity settings it is not possible to use the copy button. Please manually copy the bb code with 3 fast left clicks into the textara. Then press ctrl+c");
   }
   return false;
}
//-->
</script>
EOT;

$fullsize_url get_pic_url($pic_data);  //here we grab the url to the fullsized pic
$thumb_url get_pic_url($pic_data'thumb'); //thumb url

$pic_data['title'] ? $name $pic_data['title'] : $name 'No Title'//chcking if the pic has a title, if not we set it to 'No title'

//here we define the actual bbcode coppermine path + the path to the pic $img_url is for the version that displays the thumb, $name_url is for a txt link with the ikmage title

$img_url '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.'][IMG]'.$CONFIG['ecards_more_pic_target'].$thumb_url.'[/IMG][/url]';
$name_url '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.']'.$name.'[/url]';
$img_dir_url $CONFIG['ecards_more_pic_target'].$fullsize_url;
$img_dir_url_forum '[IMG]'.$CONFIG['ecards_more_pic_target'].$fullsize_url.'[/IMG]';

//this just brings everything in form... we create a table etc.

$bbcode_data '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '<td>Thumbnail Size</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40" style="overflow:off;">'.$img_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_url.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td>Full Size</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$img_dir_url_forum.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_dir_url_forum.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td>Direct Link</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$img_dir_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_dir_url.'")\'></td>';

$bbcode_data .= '</tr></table>';


//finally we add the created stuff to the picture data and return it to coppermine
$pic_data['html'] = $pic_data['html'].$bbcode_data

return $pic_data
}
?>


I get the results in the image attached. How can I fix the second text area to show the code for the image and not just the [IMG] tag?

Thanks

Stramm

Can't suggest more except checking your css (seems to be theme related for me) as you haven't posted a link to your gallery.


My above post was meant for the lines similar to
$bbcode_data .= '<td><label for="ftl">Thumbnail for forums:</label><input type="text" id="ftl" value=\''.$img_url.'></td>';

This is definitely wrong syntax and should be corrected the way I told you

DonRN

The link to my gallery and an image displaying the problem is as follows:

http://www.lifeinmybackyard.com/photoalbums/displayimage.php?album=6&pos=27

I have changed the code to:
$bbcode_data .= '<td>Full Size</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$img_dir_url_forum.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_dir_url_forum.'")\'></td>';


Thanks

DonRN

I have tried every possible solution offered in this thread without my problem being solved. Can someone help me figure out why the actual url does not show up on the "Full Size" line?

The link to my gallery displaying my problem (the second line to copy) is:

http://lifeinmybackyard.com/photoalbums/displayimage.php?album=6&pos=28

The code I have is:
//here we define the actual bbcode coppermine path + the path to the pic $img_url is for the version that displays the thumb, $name_url is for a txt link with the ikmage title

$img_url = '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.'][IMG]'.$CONFIG['ecards_more_pic_target'].$thumb_url.'[/IMG][/url]';
$name_url = '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.']'.$name.'[/url]';
$img_dir_url = $CONFIG['ecards_more_pic_target'].$fullsize_url;
$img_dir_url_forum = '[IMG]'.$CONFIG['ecards_more_pic_target'].$fullsize_url.'[/IMG]';

//this just brings everything in form... we create a table etc.

$bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '<td>Thumbnail Size</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40" style="overflow:off;">'.$img_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_url.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td>Full Size</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$img_dir_url_forum.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_dir_url_forum.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td>Direct Link</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$img_dir_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_dir_url.'")\'></td>';

$bbcode_data .= '</tr></table>';



I'm sorry if I am being a pest, but I don't know much about php and don't know how to fix this.

Thanks

Nibbler

Looks fine to me. You just need to scroll the box to see the full code.

Troyl

i have used the code DonRN posted since it was just what i needed but it still didnt fix one of my problems

heres the link to my site. http://www.venommustangs.com/pics/cpg1410/displayimage.php?album=random&cat=0&pos=-823
as you can see you have to stroll along way to even see the pic

any idea? or is it just my theme?

Stramm

That's the drawback of a solution that puts the url visible in one line.

Troyl

so it cant be fixxed? ur side and DonRN look good :( i dont care about seeing the url on 1 line all i do is hit the copy buttion anyway.

Stramm

just don't use 'overflow' so that the line can break

Troyl

i found out my problem i have to replace '.$CONFIG['picture_width'].' with auto and it fixed my problem


Stramm


youki517

Very fine PlugIn, but i have one problem:
how to use this plug-in to the thumbnails below, thank you!

flapane

Hi
I modified the code in this way
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40" style="overflow:off;">'.$img_url.' [SIZE="1"]Click on a photo for various data and zoom[/SIZE]</textarea></td>';

If I paste it in a bb, the text will appear at the right of the photo.
Any way to put it UNDER the photo?
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Jixzer

This looks like a great plugin, but before I use it, I have a pretty simple question that I didn't see asked.  I have the JS/FLV movie player mod added to my gallery. 

Example: http://www.freakingamers.com/gallery/displayimage.php?album=8&pos=0

Will this mod be able to tell the difference between an flv/mov/avi and all it's associated code and a standard image?

Thanks.

Jixzer

I installed the plugin and as I suspected, it does not tell the difference between a picture and a video. For my vids, it simply shows the default thumbnail.  I modded the plugin to show the full size image versus a thumbnail.  I'd like the data to be as accessible as possible and would rather they see the full product in the intended thread rather than having to link away.

Is there anyway to modify this plugin to recognize the difference between a picture and a video and include all the data required to embed a playable video in the forums rather than a link to the gallery?

Basically, the data that will need to be included is this (example):

<embed src="mediaplayer.swf" width='424' height='340' allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file=albums/userpics/10002/ABKinAction.flv&image=images/thumb_movie.jpg"></embed>

If a bbcode needs to be added, that's fine.

Thanks.