I`m trying to add Open Graph meta data to coppermine gallery:
I manage to add the title and type:
<meta property="og:title" content="{TITLE}" />
<meta property="og:type" content="website" />
I want to add the og:url and og:image meta tags, but i need the correct code so that coppermine will generate the unique tags for every page.
What can i use for url and image so i can enable Open Graph meta information for social networks ?
<meta property="og:url" content="????????" />
<meta property="og:image" content="?????????" />
I`m editing template.html.
If you need unique criteria, I suggest to use the picture ID (pid). Does Open Graph supports something like that, or can you "abuse" some existing field for that information?
I`m not a coder, i don`t know how to do that :(
Don`t know what to code to insert to generate a unique image url and picture location to use with open graph.
As you can see if i use
<meta property="og:title" content="{TITLE}" />
I get the real page title in the meta content, but what code to insert for
<meta property="og:url" content="????????" />
<meta property="og:image" content="?????????" />
so i can get unique url and image file location. How to generate them ?
First of all, I don't know Open Graph nor support it. You need to tell us which data you need to insert. Then, we can tell you how to do that.
You said you're currently editing template.html. I assume you just need that meta data for intermediate-sized image pages? Regardless, we probably need to edit theme.php to add data dynamicly.
I need a unique url for "og:url" and image location for "og:image" to be generated dynamic.
A custom header witch ads this information on every page...
A simple question is: How to dynamic generate a image url and image location for every page-view and show up on the page.
If open graph works with content="{TITLE}" and generates the page title, it will work with some other code that generates image URL and location.
I think i need to edit theme.php and add this function function pageheader($section, $meta = '') from sample theme but i don't know how to construct the $meta
I tried $meta = <meta property="og:url" content="link here" /> but is not working, my site is crashing.
//meta open graph
$meta = <<<EOT <meta property="og:url" content="link aici" /> EOT;
Some ideas ?
I added this to theme.php :
/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
// Variabile pentru aflarea pid-ului unic START
$superCage = Inspekt::makeSuperCage();
$pid = $superCage->get->getInt('pid');
// Variabile pentru aflarea pid-ului unic END
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=$pid" />';
$charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
header("Content-Type: text/html; charset=$charset");
user_save_profile();
$template_vars = array(
'{LANG_DIR}' => $lang_text_dir,
'{TITLE}' => theme_page_title($section),
'{CHARSET}' => $charset,
'{META}' => $meta,
'{GAL_NAME}' => $CONFIG['gallery_name'],
'{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
'{SYS_MENU}' => theme_main_menu('sys_menu'),
'{SUB_MENU}' => theme_main_menu('sub_menu'),
'{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CUSTOM_HEADER}' => $custom_header,
'{JAVASCRIPT}' => theme_javascript_head(),
'{MESSAGE_BLOCK}' => theme_display_message_block(),
);
$template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
echo template_eval($template_header, $template_vars);
// Show various admin messages
adminmessages();
}
/******************************************************************************
** Section <<<pageheader>>> - END
******************************************************************************/
You can see that i defined $meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=$pid" />'; witch displays <meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=$pid" /> in browser meta data, but i can`t make the URL to by dynamic: imagini.moinesti.biz/displayimage.php?pid=$pid stays the same and does not change into imagini.moinesti.biz/displayimage.php?pid=140 etc. ...
Try replacing:
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=$pid" />';
with:
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=' . $pid . '" />';
so it doesn't read $pid as part of the url, but as a variable.
Not sure if it'll do the trick, that depends on other parts of the code as well, but it'll get you closer to where you want to be.
Yes, is working now, thanks. 8)
This is only half fixed, i need now to display this custom meta data only on displayimage.php and i need to insert another meta data into $meta , the image file location for facebook to use with the share button to create a timeline story. <meta property="og:image" content="dynamic and direct path to file location" />
Facebook share looks very nice now with this new open graph data :)
That code would look something like:
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=' . $pid . '" />';
if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'])) {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . "{$CURRENT_PIC_DATA['filepath']}" . 'normal_' . "{$CURRENT_PIC_DATA['filename']}" . '" />';
} else {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . "{$CURRENT_PIC_DATA['filepath']}" . "{$CURRENT_PIC_DATA['filename']}" . '" />';
}
I must say I'm not a coder either, so I can't guarantee this will work. You may have to tweak the code here and there.
The meta data is displayed only on displayimage.php but like this:
<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=71" /><meta property="og:image" content="http://imagini.moinesti.biz/" />
meta property="og:image" must be a direct link to an intermediate file location and a <br> is needed to show <meta property="og:image" content="http://imagini.moinesti.biz/" /> down on a second line.
Like I said, I'm no coder, so it's gonna be hit and miss :)
Try this:
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=' . $pid . '" />' . $LINEBREAK;
if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'])) {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . {$CURRENT_PIC_DATA['filepath']} . 'normal_' . {$CURRENT_PIC_DATA['filename']}" . ' />';
} else {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . {$CURRENT_PIC_DATA['filepath']} . {$CURRENT_PIC_DATA['filename']} . '" />';
}
The "if" statement is there to link to the fullsize image in case no intermediate file has been generated (for instance if the file dimensions were smaller than those of the intermediate settings or the option has been turned off).
Sorry, left a double quote in there which will result in an empty page...
Here's the correct version (I hope):
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=' . $pid . '" />' . $LINEBREAK;
if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'])) {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . {$CURRENT_PIC_DATA['filepath']} . 'normal_' . {$CURRENT_PIC_DATA['filename']} . ' />';
} else {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . {$CURRENT_PIC_DATA['filepath']} . {$CURRENT_PIC_DATA['filename']} . '" />';
}
You may also want to try leaving the {} out like this:
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=' . $pid . '" />' . $LINEBREAK;
if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'])) {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . $CURRENT_PIC_DATA['filepath'] . 'normal_' . $CURRENT_PIC_DATA['filename'] . ' />';
} else {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
}
This is how I code: Trial and Error ;). See what works, and what doesn't.
Quote from: Anturaju93 on December 18, 2013, 07:08:23 AM
The meta data is displayed only on displayimage.php
I cannot see any code that is responsible to display your additional meta data just on
displayimage.php. Have you added anything different you haven't posted yet?
Quote from: E. William on December 18, 2013, 08:58:41 AM
You may also want to try leaving the {} out like this:
$meta = '<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=' . $pid . '" />' . $LINEBREAK;
if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'])) {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . $CURRENT_PIC_DATA['filepath'] . 'normal_' . $CURRENT_PIC_DATA['filename'] . ' />';
} else {
$meta .= '<meta property="og:image" content="http://imagini.moinesti.biz/' . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
}
This is how I code: Trial and Error ;). See what works, and what doesn't.
Not working, now meta data is displayed on all pages, not only displayimage.php.
There is no line break between meta code, and image URL its not generated :
<meta property="og:url" content="http://imagini.moinesti.biz/displayimage.php?pid=250" /><meta property="og:image" content="http://imagini.moinesti.biz/" />
URL for "og:image" must be dynamic generated like this http://imagini.moinesti.biz/albums/userpics/10001/normal_Toamna_in_Parc_Moinesti_19.jpg , and only be prezent on displayimage.php
Quote from: Αndré on December 18, 2013, 09:22:34 AM
I cannot see any code that is responsible to display your additional meta data just on displayimage.php. Have you added anything different you haven't posted yet?
The code is not working correctly , so i do not leave it on my site yet.
Use this code:
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$superCage = Inspekt::makeSuperCage();
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $superCage->get->getInt('pid') . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
}
Yes Andre, working all okay now.
Thanks Andre and William for your help :)
Facebook debugger:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fimagini.moinesti.biz%2Fdisplayimage.php%3Fpid%3D775%23top_display_media
Quote from: Αndré on December 18, 2013, 09:53:21 AM
Use this code:
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$superCage = Inspekt::makeSuperCage();
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $superCage->get->getInt('pid') . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
}
Hello,
I used this code and it works like a charm for which I thank you but now it seems that it doesn't quite fit my requirements.
Sharing services like addthis and also the generic facebook share use these meta tags and don't display any image when they are missing.
So could it be possible also to display the meta tags for og:url and og:image in the thumbnails.php also?
This can be debugged here for instance - https://developers.facebook.com/tools/debug/og/object/ to see what will be the share result and if you share from thumbnails.php there is no image.
For the test I share for example Last Additions from http://www.greatmusclebodies.com/thumbnails.php?album=lastup&cat=0 and I want the og:url tag to be in there with a og:image tag for an image (it doesn't matter which image as long as there is one).
I hope you understand what I mean.
Is it possible to also to display the
Updated code:
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
$thumb = mysql_fetch_assoc(cpg_db_query("SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} ORDER BY pid DESC LIMIT 1"));
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $CURRENT_ALBUM_DATA['aid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}
Thank you, Αndré!
This does the job. I was lurking around the forum almost every day and reading other topics but didn't notice you replied here until now, silly me.
There is a minor issue though, when I open the lastup meta album of a category for example, it gives an error. The elseif seems to make it because when I leave only the function for displayimage it works normally. Here's an example of what's happening: http://www.greatmusclebodies.com/thumbnails.php?album=lastup&cat=3
Template error
Failed to find block 'file_line' (#<!-- BEGIN file_line -->(.*?)<!-- END file_line -->#s) in :
<div class="{CSS_CLASS}">
<h2>{HEADER_TXT}</h2>
<span class="cpg_user_message">{MESSAGE}</span>
<br /><br />
</div>
Forgot to mention that it also happens for the others like "toprated", "topn" and "lastcom" if relevant.
I think it's related to the negative/positive ID of the albums/categories and I was just looking at the codebase.php of the cpg1.5.x_plugin_social-sharing_v1.5 plugin which seems to address the same issue when generating the meta tags but my understanding of the code is very limited.
Do you also need the open graph meta data in the header for Coppermine meta albums (lastup, etc.) or can it be ommitted?
Well, if it's not hard to show meta data also for the meta albums' header - yes. But if involves much headbanging and it's not trivial you can just shield it in some way, so that it doesn't give the error at least.
I also noticed that the search also gets broken by this so I guess it's not going to be trivial.
The search is also just a meta album (in the Coppermine world). For almost all meta albums it should be possible to choose a picture from its content. If it's "not possible" (e.g. for meta album "search"), I'll select a random picture from the database. Of course it would also be possible to choose a static picture for all meta albums. Just let me know what's your preferred behavior.
For the meta albums - choose a picture from its content and if it's "not possible, no results for the album, meta album search, etc." just select a random picture from the database.
I decided to always use a random picture for meta albums:
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= $LINEBREAK . '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />';
$meta .= $LINEBREAK . '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
if ($CURRENT_ALBUM_DATA['aid']) {
$album = $CURRENT_ALBUM_DATA['aid'];
$sql = "SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND aid = '{$CURRENT_ALBUM_DATA['aid']}' ORDER BY pid DESC LIMIT 1";
} else {
$superCage = Inspekt::makeSuperCage();
$album = $superCage->get->getAlpha('album');
$sql = "SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' ORDER BY RAND() LIMIT 1";
}
$thumb = mysql_fetch_assoc(cpg_db_query($sql));
$meta .= $LINEBREAK . '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $album . '" />';
$meta .= $LINEBREAK . '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}
That's great! Thanks, Αndré! :)
I'd like to add the open graph meta tags also to my cpg 1.5.34 installation.
I am using the 'rainy day' theme but can't find the /******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
in the theme.php
However, it is found in the sample theme.php so I guess this is used... ?
Where exactly would I have to paste the code for the open graph meta tags?
Yes, you have to copy this function from sample theme.php if you don't have it in yours and paste the additional code inside it.
Probably I made a mistake - thats why I asked where exaclty to paste it...
My page header section now looks like this:
/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= $LINEBREAK . '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />';
$meta .= $LINEBREAK . '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
if ($CURRENT_ALBUM_DATA['aid']) {
$album = $CURRENT_ALBUM_DATA['aid'];
$sql = "SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND aid = '{$CURRENT_ALBUM_DATA['aid']}' ORDER BY pid DESC LIMIT 1";
} else {
$superCage = Inspekt::makeSuperCage();
$album = $superCage->get->getAlpha('album');
$sql = "SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' ORDER BY RAND() LIMIT 1";
}
$thumb = mysql_fetch_assoc(cpg_db_query($sql));
$meta .= $LINEBREAK . '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $album . '" />';
$meta .= $LINEBREAK . '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
$charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
header("Content-Type: text/html; charset=$charset");
user_save_profile();
$template_vars = array(
'{LANG_DIR}' => $lang_text_dir,
'{TITLE}' => theme_page_title($section),
'{CHARSET}' => $charset,
'{META}' => $meta,
'{GAL_NAME}' => $CONFIG['gallery_name'],
'{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
'{SYS_MENU}' => theme_main_menu('sys_menu'),
'{SUB_MENU}' => theme_main_menu('sub_menu'),
'{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CUSTOM_HEADER}' => $custom_header,
'{JAVASCRIPT}' => theme_javascript_head(),
'{MESSAGE_BLOCK}' => theme_display_message_block(),
);
$template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
echo template_eval($template_header, $template_vars);
// Show various admin messages
adminmessages();
}
/******************************************************************************
** Section <<<pageheader>>> - END
******************************************************************************/
But I get the following error:
QuoteTemplate error
Failed to find block 'file_line' (#<!-- BEGIN file_line -->(.*?)<!-- END file_line -->#s) in :
<div class="{CSS_CLASS}">
<h2>{HEADER_TXT}</h2>
<span class="cpg_user_message">{MESSAGE}</span>
<br /><br />
</div>
Here's how I've put the code and my first part of the section looks like:
/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
$thumb = mysql_fetch_assoc(cpg_db_query("SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} ORDER BY pid DESC LIMIT 1"));
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $CURRENT_ALBUM_DATA['aid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
$charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
Hello!
I added the code and now it shows the image in FB but now I receive and error while trying to see all the images of an author.
Here the code i applied to theme.php
/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
$thumb = mysql_fetch_assoc(cpg_db_query("SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} ORDER BY pid DESC LIMIT 1"));
$meta .= '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $CURRENT_ALBUM_DATA['aid'] . '" />' . $LINEBREAK;
$meta .= '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
$charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
header("Content-Type: text/html; charset=$charset");
user_save_profile();
$template_vars = array(
'{LANG_DIR}' => $lang_text_dir,
'{TITLE}' => theme_page_title($section),
'{CHARSET}' => $charset,
'{META}' => $meta,
'{GAL_NAME}' => $CONFIG['gallery_name'],
'{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
'{SYS_MENU}' => theme_main_menu('sys_menu'),
'{SUB_MENU}' => theme_main_menu('sub_menu'),
'{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CUSTOM_HEADER}' => $custom_header,
'{JAVASCRIPT}' => theme_javascript_head(),
'{MESSAGE_BLOCK}' => theme_display_message_block(),
);
$template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
echo template_eval($template_header, $template_vars);
// Show various admin messages
adminmessages();
}
/******************************************************************************
** Section <<<pageheader>>> - END
******************************************************************************/
Here the error I receive:
QuoteTemplate error
Failed to find block 'output_buffer' (#<!-- BEGIN output_buffer -->(.*?)<!-- END output_buffer -->#s) in :
<div class="{CSS_CLASS}">
<h2>{HEADER_TXT}</h2>
<span class="cpg_user_message">{MESSAGE}</span>
<!-- BEGIN file_line -->
<br />
<br />
{FILE_TXT}{FILE} - {LINE_TXT}{LINE}
<!-- END file_line -->
<br /><br />
</div>
What do I wrong?
Thx in advance
Cannot confirm. Please post a link to your gallery and a link where we can see the error "in action". I assume it'll look like http://planepix.nl/thumbnails.php?album=lastupby&uid=4 (i.e. the "lastupby" meta album). That's at least what I tested and as you can see, the mod works as expected in that gallery.
Hi @André, I'm using your code but it seems like the SQL query isn't working ($thumb = mysql_fetch_assoc(cpg_db_query($sql));)
This is what I have on my theme.php file:
global $CPG_PHP_SELF, $LINEBREAK, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;
if ($CPG_PHP_SELF == 'displayimage.php') {
$meta .= $LINEBREAK . '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" />';
$meta .= $LINEBREAK . '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
$meta .= $LINEBREAK . '<meta property="twitter:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'] . '" />';
} elseif ($CPG_PHP_SELF == 'thumbnails.php') {
if ($CURRENT_ALBUM_DATA['aid']) {
$album = $CURRENT_ALBUM_DATA['aid'];
$sql = "SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND aid = '{$CURRENT_ALBUM_DATA['aid']}' ORDER BY pid DESC LIMIT 1";
} else {
$superCage = Inspekt::makeSuperCage();
$album = $superCage->get->getAlpha('album');
$sql = "SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' ORDER BY RAND() LIMIT 1";
}
$thumb = mysql_fetch_assoc(cpg_db_query($sql));
$meta .= $LINEBREAK . '<meta property="og:url" content="' . $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=' . $album . '" />';
$meta .= $LINEBREAK . '<meta property="og:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
$meta .= $LINEBREAK . '<meta property="twitter:image" content="' . $CONFIG['ecards_more_pic_target'] . $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'] . '" />';
}