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]   Go Down

Author Topic: full url to the intermediary picture  (Read 7323 times)

0 Members and 1 Guest are viewing this topic.

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
full url to the intermediary picture
« on: March 18, 2008, 10:12:29 pm »

hello,

How do I obtain the full url to the intermediary picture.

I need this information to display this on the intermediary page.  And the file that I am trying to get this information into is the theme.php.

So is there a variable I can call in the intermediary section of the theme.php page?

so that it shows the full address as http://www.mysite.com/albums/userpics/1001/pic1.jpg.

Thanks
Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #1 on: March 18, 2008, 11:20:02 pm »

I intend to put some javascript in theme.php


//********************************************
// HTML template for intermediate image display
//*********************************************

How can I extract the absolute path to the intermediary picture displayed.





Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: full url to the intermediary picture
« Reply #2 on: March 19, 2008, 12:23:53 am »

1. Check if your theme.php has function theme_html_picinfo.
2. If not, copy it from sample theme's theme.php to your theme.php.
3. Find this line:
Code: [Select]
return $html;4. Before it, paste the following, replacing path.to.your.gallery.com with the URL to your gallery:
Code: [Select]
global $CURRENT_PIC_DATA;
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$html .= sprintf($template, 'Intermediate size URL', '<a href="http://path.to.your.gallery.com/'.$picture_url.'">http://path.to.your.gallery.com/'.$picture_url.'</a>');
5. Enjoy.
« Last Edit: March 19, 2008, 12:33:00 am by Timos-Welt »
Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #3 on: March 19, 2008, 01:00:21 am »

thanks for the reply.

here's what I have done:

I put the code you stated inside theme.php.  Just above the following


I am trying to call the function inside html template for intermediary picture as follows.
<script language="javascript">
                  var fulladdress=theme_html_picinfo(&info);

                  document.write(fulladdress);
                  </script>

Full code below:

Code: [Select]

function theme_html_picinfo(&$info)
{
    global $lang_picinfo;

    $html = '';

    $html .= "        <tr><td colspan=\"2\" class=\"tableh2_compact\"><b>{$lang_picinfo['title']}</b></td></tr>\n";
    $template = "        <tr><td class=\"tableb_compact\" valign=\"top\" >%s:</td><td class=\"tableb_compact\">%s</td></tr>\n";
    foreach ($info as $key => $value) $html .= sprintf($template, $key, $value);

global $CURRENT_PIC_DATA;
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$html .= sprintf($template, 'Intermediate size URL', '<a href="http://mysite.com/'.$picture_url.'">http://mysite.com/'.$picture_url.'</a>');



    return $html;
}


//********************************************
// HTML template for intermediate image display
//*********************************************
$template_display_media = <<<EOT


       <!--new stuff-->


<script language="javascript">
var fulladdress=theme_html_picinfo(&info);

document.write(fulladdress);
</script>
<!--END OF NEW STUFF-->


Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #4 on: March 19, 2008, 01:01:59 am »

I am not sure if called the function properly when declaring the variable in the javascript
Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #5 on: March 19, 2008, 01:23:24 am »

Just to clarify.

What I am after is the full path to the intermediary picture so that I can use it in a javascript variable as follows:


Code: [Select]
//********************************************
// HTML template for intermediate image display
//*********************************************
$template_display_media = <<<EOT


       <!--new stuff-->


<script language="javascript">
[b]var fulladdress[/b]=theme_html_picinfo(&info);

document.write(fulladdress);
</script>
<!--END OF NEW STUFF-->
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: full url to the intermediary picture
« Reply #6 on: March 19, 2008, 04:50:50 am »

You can't call a php function from javascript, what you should do is create the javascript variable dynamically like so:

Code: (php) [Select]
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$javascript_pic_url = 'http://mysite.com/' . $picture_url;

$template_display_media = <<<EOT
       <!--new stuff-->
<script language="javascript">
var fulladdress = "$javascript_pic_url";
document.write(fulladdress);
</script>
      <!--END OF NEW STUFF-->
EOT;


Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #7 on: March 19, 2008, 05:50:25 am »

firstly thank for looking into this, SaWey

I copied the exact code you stated into theme.php.
I noticed that $picture_url is outputting nothing.
So it outputs only :http://mysite.com/

So I tried adding the following line before your code like Timos-Welt had in his code:
But that did not make  a difference:  global $CURRENT_PIC_DATA;

Note I did not use any of Timos-welt's code here

Code: [Select]
global $CURRENT_PIC_DATA;
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$javascript_pic_url = 'http://mysite.com/' . $picture_url;

//********************************************
// HTML template for intermediate image display
//*********************************************
$template_display_media = <<<EOT


<!--new stuff-->
<script language="javascript">
var fulladdress = "$picture_url";
document.write(fulladdress);

//document.write("hello");
</script>
      <!--END OF NEW STUFF-->

Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: full url to the intermediary picture
« Reply #8 on: March 19, 2008, 05:43:42 pm »

This is what I tried, as I suggested:
Code: [Select]
function theme_html_picinfo(&$info)
{
    global $lang_picinfo, $CURRENT_PIC_DATA;

$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$javascript_pic_url = 'http://mysite.com/' . $picture_url;

$html .= <<<EOT
       <!--new stuff-->
<script language="javascript">
var fulladdress = "$javascript_pic_url";
document.write(fulladdress);
</script>
      <!--END OF NEW STUFF-->
EOT;
 

    $html .= "        <tr><td colspan=\"2\" class=\"tableh2_compact\"><b>{$lang_picinfo['title']}</b></td></tr>\n";
    $template = "        <tr><td class=\"tableb_compact\" valign=\"top\" >%s:</td><td class=\"tableb_compact\">%s</td></tr>\n";
    foreach ($info as $key => $value) $html .= sprintf($template, $key, $value);

    return $html;
}

Works without a problem.
Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #9 on: April 02, 2008, 08:48:31 pm »

Having some problems:

First let me give an outline of the intermediate page layout;

[picture]
[picture title]
[picture description]
[filmstrip]
[rating]
[file information]
[add your comment]

 with that setup,  the full url is displayed in the "file information section"

I would like to display the full address right below the [picture title]  by adding the code into $template_display_media in theme.php


I tried entering the quoted code into $template_display_media but could not display it.

I am confused as the variable $template_display_media is a php variable that is holding html information.
Now I need to use php inside this variable.

So this is what i tried

I have cut out the needed code from the previous example
Code: [Select]
global $lang_picinfo, $CURRENT_PIC_DATA;

$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$javascript_pic_url = 'http://mysite.com/' . $picture_url;


     
<script language="javascript">
var fulladdress = "$javascript_pic_url";
document.write(fulladdress);
</script>
   

and tried pasting into $template_display_media in theme.php but without success as follows:

Code: [Select]
// HTML template for intermediate image display
$template_display_media = <<<EOT



<?php
global $lang_picinfo$CURRENT_PIC_DATA;

$picture_url get_pic_url($CURRENT_PIC_DATA'normal');
$javascript_pic_url 'http://mysite.com/' $picture_url;


     
<script language="javascript">
var fulladdress "$javascript_pic_url";
document.write(fulladdress);
</script>
?>







        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                <tr><td>
                                                <table width="100%" cellspacing="2" cellpadding="0" class="tableb">
                                <tr>
                                        <td align="center">

                                                {ADMIN_MENU}
                                        </td>
                                </tr>
                        </table>





<!-- BEGIN img_desc -->
                        <table cellpadding="0" cellspacing="0" class="tableb" width="100%">
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb"><center><b>
                                                {TITLE}
                                        </b></center></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb"><center>
                                                {CAPTION}
                                        </center></td>
                                </tr>
<!-- END caption -->
                        </table>
<!-- END img_desc -->
                </td>
        </tr>

EOT;


Thanks for the previous replies.  Hopefully this can be resolved.  I messed around with it for a while w/o success.
Another confusion is that the variable $template_display_media is a php variable and then I am putting more php into it by using

<?php

code
?>

Logged

veez

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: full url to the intermediary picture
« Reply #10 on: April 06, 2008, 01:55:23 am »

Okay, perhaps that was too specific.

Could someone please tell me how to get the full url to the image when putting it in a new function.


From the previous code snippets,  I tried to make a new function and use the full address to the intermediary picture

Code: [Select]
function newfunction()
{

global $lang_picinfo, $CURRENT_PIC_DATA;


$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
$name = 'http://mysite.com/' . $picture_url;

return $name;
}


When I try to output it, the variable, $picture_url is empty.

Any ideas?

Thanks
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 20 queries.