Advanced search  

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]

Pages: 1 [2] 3 4   Go Down

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

0 Members and 1 Guest are viewing this topic.

DanTheMan

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Generate a link to the picture automaticaly for copy paste.
« Reply #20 on: November 26, 2004, 04:10:36 am »

Using b2evolution for family blog, needed a media library. Played around with a few, tried Coppermine, found it really good. Thanks to the developers.

Anyway, don't know much about intergrating with b2evo but all I needed was a way to copy-and-paste the thumbnail with a link to the pic in the album, read this post, grepped a few of the php files so this is what I have done. It puts a (non-hyperlinked) "Post to Weblog'" row under the URL row in the picture info spot. The file edited was displayimage.php
.. the mod is the part commented with 'create an absolute image link for the pic'

-------
Code: [Select]
    // Create the absolute URL for display in info
    $info['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

    // create an absolute image link for the pic
$info['Paste to Weblog'] = '&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" /&gt;&lt;/a&gt;';

    // Create the add to fav link
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['remFav'] . '</a>';
    }
-----

the only part I'm not a 100% sure about is using $CONFIG['thumb_width'] as the pic height. Will this always be correct?

Hope this helps - Dan
« Last Edit: November 26, 2004, 04:19:20 am by TranzNDance »
Logged

Nibbler

  • Guest
Re: Generate a link to the picture automaticly for copy paste.
« Reply #21 on: November 26, 2004, 11:40:56 am »

The dimensions of the thumbnail are not stored by coppermine, so you'd have to read them from the file directly.
Logged

St. Anger

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 107
Re: Generate a link to the picture automaticly for copy paste.
« Reply #22 on: December 13, 2004, 06:11:05 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

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

inductionconcepts

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Generate a link to the picture automaticly for copy paste.
« Reply #23 on: December 19, 2004, 07:56:12 am »

Quote
{add under}

Code:
    // Create the image link for display in info
    $info['link'] = $picture_url;

This didn't work for me however the second mod code posted

Quote
// Create the image link for display in info
    $info['Link'] = "http://".($_SERVER['SERVER_NAME'])."/".$path_to_pic;


But I had to change the

NAME'])."/".$path_to_pic;

to

NAME'])."/gallery/".$path_to_pic;

to get the link correct because I have my coppermine in it own folder named /gallery/ and it woudn't show up in the link at all unless I added the /gallery/ to the code ..



However I am wondering if there a code to make the whole path clickable link to image?


Thanks

Bill

What file is this modification made in?
Logged

Nibbler

  • Guest
Re: Generate a link to the picture automaticly for copy paste.
« Reply #24 on: December 19, 2004, 01:10:41 pm »

... The file edited was displayimage.php ...
;)
Logged

bobimus

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Generate a link to the picture automaticly for copy paste.
« Reply #25 on: January 06, 2005, 05:37:38 am »

Help please, I always get a parser error on line 334.  I've tried all the different scripts above, it just won't work.
Logged

Nibbler

  • Guest
Re: Generate a link to the picture automaticly for copy paste.
« Reply #26 on: January 06, 2005, 05:39:24 am »

Why don't you post the exact error and line 334, plus a few lines above and below.
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Generate a link to the picture automaticly for copy paste.
« Reply #27 on: March 20, 2005, 01:41:19 am »

Here's a modified version of the suggestions. It includes a conditional so that it only displays while in admin mode; regular users won't see it. If you want regular users to see, remove the conditional. This includes variations for bbc and html coding, with and without linking. It would be placed in the same place as advised in other posts.

Adjust to suit your needs:

Code: [Select]
if (GALLERY_ADMIN_MODE) {
$info['HTML without link'] = '&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;';
$info['HTML with link'] = '&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;';
$info['BBC without link'] = '[img]<br />'. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . get_pic_url($CURRENT_PIC_DATA,'thumb') . '<br />[/img]';
$info['BBC with link'] = '[url=' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '][img]<br />'. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . get_pic_url($CURRENT_PIC_DATA,'thumb') . '<br />[/img][/url]';
}
Logged

mlanham

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Generate a link to the picture automaticly for copy paste.
« Reply #28 on: March 21, 2005, 05:20:18 am »

Why don't you post the exact error and line 334, plus a few lines above and below.

He might not, but I will! :)

I get this error:
Code: [Select]
Parse error: parse error, unexpected T_STRING in /home/[HOMEDIRECTORY]/public_html/copperminetest/displayimage.php on line 338
and have this: (lines 337-339)
Code: [Select]
// Create the absolute URL for display in info
    $info['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

Sorry, I'm a complete newbie and understand very little of this.  ;D
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 #29 on: March 29, 2005, 12:03:24 pm »

I haven't checked what that code's doing so don't blame me if it doesn't work as you expect. It's just error corrected.

Code: [Select]
    $info['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>";

Sonikempire

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • SonikEmpire
Re: Generate a link to the picture automaticly for copy paste.
« Reply #30 on: April 26, 2005, 03:33:19 am »

Is it possible to create the link so it shows the full path to the normal_pic.jpg instead of pic.jpg
WHY? Because i don't want to post huge images into forums and i dont want to right click the pic, properties, copy paste.

This works great for me

Code: [Select]
   // Create the image link for display in info
   $info['Direct Link'] = "http://".($_SERVER['SERVER_NAME'])."/gallery/".$path_to_pic;

this didnt work
   
Code: [Select]
// Create the image link for display in info
   $info['Direct Link'] = "http://".($_SERVER['SERVER_NAME'])."/gallery/".$path_to_normal; ...etc...??/

Please help!!
www.sonikempire.com is the site, /gallery is the gallery.
bambule@gmail.com
s0nikempire on AIM
Please feel free to contact me!

THANK YOU VERY MUCH!
Logged

Crash_Sys

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Generate a link to the picture automaticly for copy paste.
« Reply #31 on: May 19, 2005, 09:47:39 am »

I have been trying to show the BB-Code for my Images, like in some of these sites, but can't make it to work, with my theme or classic theme.
I do have the BB Help on in the Admin Config! Not sure what i'm doing wrong! ???

http://www.s0ber.net/displayimage.php?album=lastcom&cat=0&pos=5
Logged

Crash_Sys

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Generate a link to the picture automaticly for copy paste.
« Reply #32 on: May 20, 2005, 02:27:02 am »

Never mind I got it to work, but Thanks.
Logged

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 #33 on: May 20, 2005, 08:07:49 am »

it would have been nice if you posted what you did to make it work for you, so others may benefit from your insight.
Logged

Crash_Sys

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Generate a link to the picture automaticly for copy paste.
« Reply #34 on: May 22, 2005, 08:12:50 am »

it would have been nice if you posted what you did to make it work for you, so others may benefit from your insight.
I could'nt make this one work, how I wanted it too, so I made one!
But if any body is interested, I could placed the code here at coppermine.
I have it confire for the users/public mode can only see the thumb version, with HTML Code and BB-Code on it. And for Members a lot of diffrent ones.
Check it out:
http://sandbox.fastefx.com/cpg1.3.3/cpg133/displayimage.php?album=random&cat=0&pos=-1

User/Public Mode:

(http://sandbox.fastefx.com/user.jpg)
Admin MODE:

(http://sandbox.fastefx.com/admin.jpg)
Logged

FedericaSanta

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Generate a link to the picture automaticly for copy paste.
« Reply #35 on: June 09, 2005, 01:55:56 pm »

it would have been nice if you posted what you did to make it work for you, so others may benefit from your insight.
I could'nt make this one work, how I wanted it too, so I made one!
But if any body is interested, I could placed the code here at coppermine.
I have it confire for the users/public mode can only see the thumb version, with HTML Code and BB-Code on it. And for Members a lot of diffrent ones.
Check it out:
http://sandbox.fastefx.com/cpg1.3.3/cpg133/displayimage.php?album=random&cat=0&pos=-1

User/Public Mode:

(http://sandbox.fastefx.com/user.jpg)
Admin MODE:

(http://sandbox.fastefx.com/admin.jpg)

Hy,
the link yuo suggest dosn't work.

Anyone can help me??
Logged

Crash_Sys

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Generate a link to the picture automaticly for copy paste.
« Reply #36 on: June 10, 2005, 08:30:20 am »

FedericaSanta, Its not active, If you need to see I could upload it, and re-install it!
Logged

FedericaSanta

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Generate a link to the picture automaticly for copy paste.
« Reply #37 on: June 10, 2005, 01:41:55 pm »

Oh yes, i just need it.

Thank, with the hope of being able to reciprocate your courtesy!!

Thanks!!!!!!
Logged

Crash_Sys

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Generate a link to the picture automaticly for copy paste.
« Reply #38 on: June 13, 2005, 04:44:15 am »

Oh yes, i just need it.

Thank, with the hope of being able to reciprocate your courtesy!!

Thanks!!!!!!

Here is the URL:
http://sandbox.fastefx.com/cpg133/index.php
Please Note, It will be there for a week.

User Account to View all of them;
UserID: test
PassWD: test
Logged

FedericaSanta

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Generate a link to the picture automaticly for copy paste.
« Reply #39 on: June 13, 2005, 02:41:24 pm »

Thanks Crash_Sys,

I have tested it on my gallery.

I have only one problem.When i try to upload a new image a get this:

Notice: Array to string conversion in ..../include/init.inc.php on line 135


Thanks a lot!!!

Logged
Pages: 1 [2] 3 4   Go Up
 

Page created in 0.025 seconds with 22 queries.