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

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.

DanTheMan

#20
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'

-------
    // 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

Nibbler

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

St. Anger

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

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.

inductionconcepts

Quote from: CBiLL on January 23, 2004, 11:16:05 PM
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?


bobimus

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

Nibbler

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

Tranz

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:

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]';
}

mlanham

Quote from: Nibbler 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.

He might not, but I will! :)

I get this error:
Parse error: parse error, unexpected T_STRING in /home/[HOMEDIRECTORY]/public_html/copperminetest/displayimage.php on line 338

and have this: (lines 337-339)
// 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

Stramm

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.

    $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

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

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


this didnt work
   // 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!

Crash_Sys

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

Crash_Sys


Joachim Müller

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

Crash_Sys

Quote from: GauGau 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.
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:

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fsandbox.fastefx.com%2Fuser.jpg&hash=87fecc7706d57e74998d1b25c67d23055b55a1c5)
Admin MODE:

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fsandbox.fastefx.com%2Fadmin.jpg&hash=c86b04d8a62f43310d0e1349bbc91d3c333e72ba)

FedericaSanta

Quote from: Crash_Sys on May 22, 2005, 08:12:50 AM
Quote from: GauGau 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.
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:

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fsandbox.fastefx.com%2Fuser.jpg&hash=87fecc7706d57e74998d1b25c67d23055b55a1c5)
Admin MODE:

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fsandbox.fastefx.com%2Fadmin.jpg&hash=c86b04d8a62f43310d0e1349bbc91d3c333e72ba)

Hy,
the link yuo suggest dosn't work.

Anyone can help me??

Crash_Sys

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

FedericaSanta

Oh yes, i just need it.

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

Thanks!!!!!!

Crash_Sys

Quote from: FedericaSanta 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!!!!!!

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

FedericaSanta

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!!!