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
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.
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:
return $html;
4. Before it, paste the following, replacing path.to.your.gallery.com with the URL to your gallery:
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.
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:
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-->
I am not sure if called the function properly when declaring the variable in the javascript
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:
//********************************************
// 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-->
You can't call a php function from javascript, what you should do is create the javascript variable dynamically like so:
$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;
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
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-->
This is what I tried, as I suggested:
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.
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
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:
// 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
?>
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
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