Advanced search  

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

Pages: 1 2 3 [4]   Go Down

Author Topic: Generate a link to the picture automaticly for copy paste.  (Read 97067 times)

0 Members and 1 Guest are viewing this topic.

svennicus

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Generate a link to the picture automaticly for copy paste.
« Reply #60 on: January 08, 2006, 12:55:22 am »

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

Code: [Select]
// 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

Code: [Select]
// *** 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 ***
Logged

Ross(SE-MI)

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 12
Copy buttons
« Reply #61 on: February 05, 2006, 08:54:06 pm »

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.

Code: [Select]
<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>
Logged

djtaz

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Generate a link to the picture automaticly for copy paste.
« Reply #62 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 :
Code: [Select]
$lang_picinfo = array(
  'title' =>'File information', //cpg1.3.0
  'Filename' => 'Filename',
  'Album name' => 'Album name',
 
 
 
Add below :   
Code: [Select]
 
  'BB Code' => 'VB Code',
_________________________________________________________________________

in /gallery/displayimage.php

Find :


Code: [Select]
   $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
Code: [Select]
//// 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
« Last Edit: February 14, 2006, 03:52:28 pm by djtaz »
Logged

Ross(SE-MI)

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 12
Thanks djtaz for the credit, however
« Reply #63 on: February 17, 2006, 04:03:02 am »

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.
Logged

ginzadune

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Generate a link to the picture automaticly for copy paste.
« Reply #64 on: February 18, 2006, 05:52:20 pm »

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...
Logged

cheenamalai

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 41
Re: Generate a link to the picture automaticly for copy paste.
« Reply #65 on: March 21, 2006, 09:59:25 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 :
Code: [Select]
$lang_picinfo = array(
  'title' =>'File information', //cpg1.3.0
  'Filename' => 'Filename',
  'Album name' => 'Album name',
 
 
 
Add below :   
Code: [Select]
 
  'BB Code' => 'VB Code',
_________________________________________________________________________

in /gallery/displayimage.php

Find :


Code: [Select]
   $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
Code: [Select]
//// 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!
Logged

Crash_Sys

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Generate a link to the picture automaticly for copy paste.
« Reply #66 on: April 03, 2006, 10:05:52 pm »

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…
Logged

dshade69

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Generate a link to the picture automaticly for copy paste.
« Reply #67 on: August 15, 2006, 11:08:39 pm »

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
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Generate a link to the picture automaticly for copy paste.
« Reply #68 on: August 16, 2006, 07:55:15 am »

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

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
  • Soy Chicano!
    • SoyChicano Gente
Re: Generate a link to the picture automaticly for copy paste.
« Reply #69 on: May 16, 2007, 11:43:05 am »

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

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Generate a link to the picture automaticly for copy paste.
« Reply #70 on: May 16, 2007, 01:16:36 pm »

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

chican0

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
  • Soy Chicano!
    • SoyChicano Gente
Re: Generate a link to the picture automaticly for copy paste.
« Reply #71 on: May 16, 2007, 06:46:14 pm »

Thanks for the correction.

MatthewSchenker

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Generate a link to the picture automaticly for copy paste.
« Reply #72 on: June 25, 2007, 02:38:45 pm »

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!

Logged

Thomas_Hansen

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Generate a link to the picture automaticly for copy paste.
« Reply #73 on: January 22, 2008, 06:29:15 pm »

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
Logged

Nibbler

  • Guest
Re: Generate a link to the picture automaticly for copy paste.
« Reply #74 on: January 22, 2008, 06:55:39 pm »

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

Thomas_Hansen

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Generate a link to the picture automaticly for copy paste.
« Reply #75 on: January 22, 2008, 07:04:41 pm »

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
Logged

Nibbler

  • Guest
Re: Generate a link to the picture automaticly for copy paste.
« Reply #76 on: January 22, 2008, 07:13:43 pm »

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.
Logged

Thomas_Hansen

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Generate a link to the picture automaticly for copy paste.
« Reply #77 on: January 22, 2008, 07:14:57 pm »

Figured it out, gotta look in the code thanks
Logged
Pages: 1 2 3 [4]   Go Up
 

Page created in 0.075 seconds with 20 queries.