Generate a link to the picture automaticly for copy paste. - Page 4 Generate a link to the picture automaticly for copy paste. - Page 4
 

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

Generate a link to the picture automaticly for copy paste.

Started by postcarduniverse, January 14, 2004, 11:53:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

svennicus

Thanks Crash_Sys, great mod.

I have made some small alterations of my own, like remove the need to hardcode your domain name, reduced the list to the links i require and also fixed all the links. (my first attempt at this by the way, didnt even know what the code looked like 2 days ago)

Still working on the copy buttons tho.

I hope this will be useful, just copy and paste, no changes needed.

Again, thanks for the mod Crash_Sys

Find lines


// Create the absolute URL for display in info
    $info[$lang_picinfo['URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" >' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '</a>';
    // with subdomains the variable is $_SERVER["SERVER_NAME"] does not return the right value instead of using a new config variable I reused $CONFIG["ecards_more_pic_target"] no trailing slash in the configure


Add following lines below


// *** Begin of USER/Public Mode BB-Code and HTML ***
    // Create the BB-Code with Link to Thumbnail for USERS/PUBLIC MODE
    $bbcodethumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb');
    $info['<b>Copy Info</b>']='<font color="#FF0000">Press Ctrl+A to Select All.</font> <font color="#008000">Then Press Ctrl+C to Copy Selected </font>';
    $info['Forum Code<br>Thumbnail<br>With URL']='<textarea type=text name=text rows=2 cols=46>[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) == '/' ? '' : '/').$bbcodethumb_url.'[/img][/url]</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:bbcodepublic();">Copy</button>';
    // Image Link with URL for HTML
    //$info['HTML Code<br>Thumbnail'] = '<textarea type=text name=text1 rows=2 cols=46>&lt;a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" &gt;&lt;img src="'. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . get_pic_url($CURRENT_PIC_DATA,'thumb') . '" height="' . $CONFIG['thumb_width'] . '" alt="' . $CURRENT_PIC_DATA['title'] . '" align="left" border="0" /&gt;&lt;/a&gt;</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:htmlcode();">Copy</button>';
    // *** END of USER/Public Mode BB-Code and HTML ***
    // *** Begin Admin Mode BB-Code List ***
      if (GALLERY_ADMIN_MODE || USER_ADMIN_MODE) {
    //Show BBcode for
  if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
     $bbcodepicture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
     } else {
     $bbcodepicture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
  }
   
    // Create Intermediate Image for Display
    //$info['Intermediate']='<textarea type=text name=text3 rows=2 cols=46>' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . (str_replace($CURRENT_PIC_DATA['filename'] , "normal_".$CURRENT_PIC_DATA['filename'] , $path_to_pic)).'</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:inter();">Copy</button>';

// Create the BB-Code with link to resized image
      $info['Forum Code<br>Intermediate']='<textarea type=text name=text5 rows=2 cols=46>[img]'.$CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/').(str_replace($CURRENT_PIC_DATA['filename'] , "normal_".$CURRENT_PIC_DATA['filename'] , $path_to_pic)).'[/img]</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:bbinter();">Copy</button>';
      $info['Forum Code<br>Intermediate<br>With URL']='<textarea type=text name=text6 rows=2 cols=46>[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) == '/' ? '' : '/').(str_replace($CURRENT_PIC_DATA['filename'] , "normal_".$CURRENT_PIC_DATA['filename'] , $path_to_pic)).'[/img][/url]</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:bbinterurl();">Copy</button>';

// Create Image Link for Display
    //$info['Full'] = "<textarea type=text name=text2 rows=2 cols=46>".$CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $path_to_pic ."</textarea>&nbsp;&nbsp;&nbsp;<button class=button onClick=javascript:link();>Copy</button>";
   
    // Show BB-Code for Full Image
    $info['Forum Code<br>Full']='<textarea type=text name=text4 rows=2 cols=46>[img]'.$CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $path_to_pic.'[/img]</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:bbcode();">Copy</button>';
   
    // Create the Image Link with URL for BBS
    //$info['Forum Code<br>Full<br>With URL']='<textarea type=text name=text4 rows=2 cols=46>[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) == '/' ? '' : '/') . $path_to_pic.'[/img][/url]</textarea>&nbsp;&nbsp;&nbsp; <button class=button onClick="javascript:bbcode();">Copy</button>';
   
      }
// *** End of Admin Mode BB-Code List ***

Ross(SE-MI)

Hi svennicus,
I am not a programer but have been researching this topic.
Not sure if this code is of any use to you but saw it on another forum.
Dealing with copy text to clipboard for pasting somewhere else across different browsers.

<script>
function copy_clip(meintext){
if (window.clipboardData){   
window.clipboardData.setData("Text", meintext);
}else if (window.netscape){
netscape.security.PrivilegeManager.enablePrivilege  ('UniversalXPConnect');

var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard  );
if (!clip) return;

var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;

trans.addDataFlavor('text/unicode');

var str = new Object();
var len = new Object();

var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);   
var copytext=meintext;   
str.data=copytext;   
trans.setTransferData("text/unicode",str,copytext.length*2);   
var clipid=Components.interfaces.nsIClipboard;

if (!clip) return false;   
clip.setData(trans,null,clipid.kGlobalClipboard);

}

return false;
}
//-->
</script>   
<form name="testform">
<textarea name="testsquare">
</textarea>
<br>
<input type="button" onclick="return copy_clip(document.forms[0].testsquare.value)" value="Copy to Clipboard">
</form>

djtaz

I think that code would work if intrgrated with another ... i didnt realise there was a BBCode output thing for coppermine , and i ended up doing my own version ...
http://forum.coppermine-gallery.net/index.php?topic=27804.0


So here is my code integrated with the code that Ross just posted for easy copying to clipboard

OK THIS IS TESTED AND IT WORKS - JUST WHAT U WANT


In /gallery/lang/english.php

Find :

$lang_picinfo = array(
  'title' =>'File information', //cpg1.3.0
  'Filename' => 'Filename',
  'Album name' => 'Album name',
 
 
 
Add below :   
 
  'BB Code' => 'VB Code',

_________________________________________________________________________

in /gallery/displayimage.php

Find :



   $info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);
   $info[$lang_picinfo['Album name']] = '<span class="alblink">' . $owner_link . $ipinfo . '<a href="thumbnails.php?album=' . $CURRENT_PIC_DATA['aid'] . '">' . $CURRENT_ALBUM_DATA['title'] . ' Photos</a></span>';

add below

//// THANKS TO ROSS FOR THE SCRIPT//
?>
<script>
function copy_clip(meintext){
if (window.clipboardData){
window.clipboardData.setData("Text", meintext);
}else if (window.netscape){
netscape.security.PrivilegeManager.enablePrivilege  ('UniversalXPConnect');

var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard  );
if (!clip) return;

var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;

trans.addDataFlavor('text/unicode');

var str = new Object();
var len = new Object();

var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var copytext=meintext;
str.data=copytext;
trans.setTransferData("text/unicode",str,copytext.length*2);
var clipid=Components.interfaces.nsIClipboard;

if (!clip) return false;
clip.setData(trans,null,clipid.kGlobalClipboard);

}

return false;
}
//-->
</script>

<?
////////////////////////////////////////////////
//// OUTPUT CODES FOR VBCODE AND HTML CODE /////
//////////////// BY DjTaz  (www.djtaz.com)//////
////////////////////////////////////////////////
$picture_url = get_pic_url($CURRENT_PIC_DATA, '');
$website = $CONFIG["ecards_more_pic_target"];
$info[$lang_picinfo['BB Code']] = "<form name=\"testform\"><textarea name=\"testsquare\" cols=35>[IMG] ".$website.$picture_url." [/IMG]</textarea><input type=\"button\" onclick=\"return copy_clip(document.forms[0].testsquare.value)\" value=\"Copy to Clipboard\"></form>";
////////////////////////////////////////////////
//// END OF VBCODE AND HTML OUTPUT CODE ////////
////////////////////////////////////////////////



Reupload both files , click and thats it , your done !
Also here :
http://www.vbulletin.org/forum/showthread.php?p=898178

Ross(SE-MI)

I can't take credit for the code just finding it & passing it on.
Only wish I remembered where I found it to give that person the proper credit.

ginzadune

Quote from: St. Anger on December 13, 2004, 06:11:05 AM
What about an option for admins to choose which way the gallery displays the URLs?  That would solve both problems since the admins could choose how the links would be displayed.

Wow - imagine that...

cheenamalai

Quote from: djtaz on February 14, 2006, 03:29:52 PM
I think that code would work if intrgrated with another ... i didnt realise there was a BBCode output thing for coppermine , and i ended up doing my own version ...
http://forum.coppermine-gallery.net/index.php?topic=27804.0


So here is my code integrated with the code that Ross just posted for easy copying to clipboard

OK THIS IS TESTED AND IT WORKS - JUST WHAT U WANT


In /gallery/lang/english.php

Find :

$lang_picinfo = array(
  'title' =>'File information', //cpg1.3.0
  'Filename' => 'Filename',
  'Album name' => 'Album name',
 
 
 
Add below :   
 
  'BB Code' => 'VB Code',

_________________________________________________________________________

in /gallery/displayimage.php

Find :



   $info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);
   $info[$lang_picinfo['Album name']] = '<span class="alblink">' . $owner_link . $ipinfo . '<a href="thumbnails.php?album=' . $CURRENT_PIC_DATA['aid'] . '">' . $CURRENT_ALBUM_DATA['title'] . ' Photos</a></span>';

add below

//// THANKS TO ROSS FOR THE SCRIPT//
?>
<script>
function copy_clip(meintext){
if (window.clipboardData){
window.clipboardData.setData("Text", meintext);
}else if (window.netscape){
netscape.security.PrivilegeManager.enablePrivilege  ('UniversalXPConnect');

var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard  );
if (!clip) return;

var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;

trans.addDataFlavor('text/unicode');

var str = new Object();
var len = new Object();

var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var copytext=meintext;
str.data=copytext;
trans.setTransferData("text/unicode",str,copytext.length*2);
var clipid=Components.interfaces.nsIClipboard;

if (!clip) return false;
clip.setData(trans,null,clipid.kGlobalClipboard);

}

return false;
}
//-->
</script>

<?
////////////////////////////////////////////////
//// OUTPUT CODES FOR VBCODE AND HTML CODE /////
//////////////// BY DjTaz  (www.djtaz.com)//////
////////////////////////////////////////////////
$picture_url = get_pic_url($CURRENT_PIC_DATA, '');
$website = $CONFIG["ecards_more_pic_target"];
$info[$lang_picinfo['BB Code']] = "<form name=\"testform\"><textarea name=\"testsquare\" cols=35>[IMG] ".$website.$picture_url." [/IMG]</textarea><input type=\"button\" onclick=\"return copy_clip(document.forms[0].testsquare.value)\" value=\"Copy to Clipboard\"></form>";
////////////////////////////////////////////////
//// END OF VBCODE AND HTML OUTPUT CODE ////////
////////////////////////////////////////////////



Reupload both files , click and thats it , your done !
Also here :
http://www.vbulletin.org/forum/showthread.php?p=898178

this isn't working. Why is that? no field nothing shows up!

Crash_Sys

I just want to inform everybody, that I will begin working on the MOD, for the latest version of Coppermine, with more power to it...

I'll be adding:

Fire Fox and most common Browsers Support.
Control what type of code to show, via Admin Control Panel...
Control what to show, TEXT/Bottom/ and so on...


And some more Modification to it...

dshade69

Quote from: GauGau on January 20, 2004, 05:47:41 AM
usually people don't want their pics to be hotlinked at all and request features to make hotlinking impossible.
Will definitely not go into a future version - most users would hate us for such a feature... :wink:

GauGau

Is it possible that we can get this feature as an option that can be turned on and off in the control panel?  I know that quite a few people do like having the direct url for the picture which is why this thread keeps turning up again and again for different versions of coppermine. 

Thanks,

Dshade69

Stramm

This is not the place for feature requests. Also there's a plugin with the basic functiuonality of this mod. You can add everything you need to that plugin and customize it to your needs.

chican0

There is really no need for a button to copy the code. You can easily modify the first FORM declaration to append the following emphasized attributes.

Quote<textarea type=text name=text1 rows=4 cols=50  onFocus="this.select()" onClick="this.select()" readonly>

Joachim Müller

Proper syntax would be <textarea type="text" name="text1" rows="4" cols="50"  onFocus="this.select();" onClick="this.select();" readonly="readonly">

chican0


MatthewSchenker

I'm very interested in this modification.

I run a woodworking forum, with a bridge to Coppermine.  My members like to pick up their photos in the gallery and use them to post inline in the posts.  It would be great to have an easy way to pick up the URL for pasting in the forum.

There seems to be a lot of great information here.  But I'm a little confused.  What's the best way to simply get the URL references to display?

Thanks for your help!


Thomas_Hansen

I think that i am missing somthing, isent there supose to be somthing in the themes.inc.php to actualy shov the link ?
Well im not getting anything if i add the $info['Link'] = "http://".($_SERVER['SERVER_NAME'])."/galleri/".$path_to_pic; in the displayimage.php

Nibbler

Do you even have the file information section displayed? Post a link to your gallery.

Thomas_Hansen

http://yal.dk/galleri/displayimage.php?album=1&pos=1

Where it says {LINK} i would like a link for the file

the file info thingy i cant find, hmmm not that smart am i

Nibbler

The file information section is displayed in a box below the pic. I can see the link where it should be. If you want it where the {LINK} is then you need to code that. This mod does not place it there.

Thomas_Hansen