coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: roovio on June 18, 2004, 09:34:49 PM

Title: Button related to picture
Post by: roovio on June 18, 2004, 09:34:49 PM
Can anybody help me in this.
I'd like to add button next to "Picture information" section. I have static html code for this button (in red color is what i'like to have taken fro each picture from database):

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="my@email.adress">
    <input type="hidden" name="item_name" value="file_number">
    <input type="hidden" name="amount" value="value_from_custo_field1">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but5.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">

Thanks for help
Rafal
Title: Re: Button related to picture
Post by: roovio on June 18, 2004, 09:37:52 PM
Sorry:
<input type="hidden" name="business" value="my@email.adress">
alway will be the same
Title: Re: Button related to picture
Post by: Joachim Müller on June 19, 2004, 10:30:13 AM
has been requested before, nobody has come with a hack so far afaik.

GauGau
Title: Re: Button related to picture
Post by: roovio on June 23, 2004, 10:34:35 PM
So far so good...
Hey there.
I don't know php but i did this:

in displayimage.php after code:

// Display picture information
function html_picinfo()
{

    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $FAVPICS;
    global $album, $lang_picinfo, $lang_display_image_php, $lang_byte_units;


i put:
    $email = "my@email.com";
    $pay_a = "https://www.paypal.com/xclick/business=";
    $pay_b = "&item_name=";
    $pay_c = "&amount=";
    $pay_d = "&no_note=1&currency_code=USD";
    $price = $CURRENT_PIC_DATA['user'.$i=1];


and after code:
    // Create the absolute URL for display in info
    $info['URL'] = '<a href=' . $CONFIG["ecards_more_pic_target"] . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . ' >' . $CONFIG["ecards_more_pic_target"] . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '</a>';


i put:

    // Create the PayPal link
    $info['Buy it Now'] = '<a href=' . $pay_a . $email . $pay_b . htmlspecialchars($CURRENT_PIC_DATA['filename']) . $pay_c . $price . $pay_d . ' >' . $pay_a . $email . $pay_b . htmlspecialchars($CURRENT_PIC_DATA['filename']) . $pay_c . $price . $pay_d . '</a>';


Maby it is not rofessional, but work.

Now. I want to show for user small button instead of whole link. Can somebody tell me how to do this???

Thank You
Rafal
Title: Re: Button related to picture
Post by: Nibbler on June 23, 2004, 10:44:27 PM
<a href="address"><img src="url to pic" alt="text description" border="0"></a>
Title: Re: Button related to picture
Post by: Joachim Müller on June 23, 2004, 11:43:57 PM
so you were able to code php out of nowhere, but you don't know the <img>-tag?

GauGau
Title: Re: Button related to picture
Post by: roovio on June 24, 2004, 12:56:20 AM
Well. It was so hard for me to find out how php is working and i forgot about simple thing.  :-[
Title: Re: Button related to picture
Post by: roovio on June 24, 2004, 02:15:40 AM
So i start to learn php... and i love it.

I changed a little code so now if You don't put price in Custom Filed 1 button don't appear also.

instead of
   // Create the PayPal link
   $info['Buy it Now'] = '<a href=' . $pay_a . $email . $pay_b . htmlspecialchars($CURRENT_PIC_DATA['filename']) . $pay_c . $price . $pay_d . ' >' . $pay_a . $email . $pay_b . htmlspecialchars($CURRENT_PIC_DATA['filename']) . $pay_c . $price . $pay_d . '</a>';


put
          if ($CURRENT_PIC_DATA['user' . $i=1] != "") {
               $info['Buy tihis picture'] = '<a href=' . $pay_a . $email . $pay_b . htmlspecialchars($CURRENT_PIC_DATA['filename']) . $pay_c . $price . $pay_d . ' ><img src="button_link" alt="Your_text" border="0"</a>';
           }