forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: kwszp on February 04, 2011, 04:39:44 pm
-
Hello,
There was a similar request (Clickable link in thumbnail view (http://forum.coppermine-gallery.net/index.php/topic,66469.0.html)) and it was beautifully resolved and works great, but the follow up idea of clickable thumbnail has never been materialized.
I'm looking for a way to direct to images from other websites, but rather in a way similar to search results of search engines, than by "embedding" them, like described for example here (http://forum.coppermine-gallery.net/index.php/topic,22564.0.html).
A clickable thumbnail (equivalent of <a target="_blank" alt="caption" href="http://www.link.to.page"><img src="thumbnail.cpg"></a>) is what I'd love to have.
The mod mentioned at the top creates clickable link under the thumbnail (link to test of modified code in my gallery (http://www.kwszp.info/galeria/thumbnails.php?album=26)), yet:
-opens the link in the gallery window
-the thumbnail is a normal gallery entity, so by clicking it one goes deeper and deeper
-hovering shows thumbnail image details
Is there a way to hack the code/create a mod with these functions:
-clicking on thumbnail opens (possibly in a new window/tab) the corresponding link (link created with bbcode could be either taken from thumb_caption or a custom field would have to be created)
-no image info is shown when thumbnail hovered
I mentioned mod, as the situation resembles a bit Remote videos for cpg (http://forum.coppermine-gallery.net/index.php/topic,60195.0.html) and I thought, that maybe modifying it to accept something like <lnk> files, containing an url, with thumbnails loaded with custom thumbnail plugin (http://forum.coppermine-gallery.net/index.php/topic,60272.0.html) would do the job?
Any help much appreciated :)
-
The Remote videos plugin doesn't affect the thumbnail view, but the intermediate-sized view. So you cannot use it for your purpose. There's an svg plugin available at the svn, which modifies the thumbnail view. Please have a look at it if you need a draft.
-
Thanks for the hint, I sat for a while, but as I am no PHP programmer, I'd rather somebody have a look at this before I accidentally infect the internet ;)
<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
$thisplugin->add_action('plugin_install', 'tlnk_install');
function tlnk_install() { //here only extension name and MIME type modified
global $CONFIG;
if (!mysql_result(cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_FILETYPES']} WHERE extension = 'tlnk'"), 0)) {
cpg_db_query("INSERT INTO {$CONFIG['TABLE_FILETYPES']} (extension, mime, content, player) VALUES ('tlnk', 'text/tlnk', 'document', '')");
} else {
cpg_db_query("UPDATE {$CONFIG['TABLE_FILETYPES']} SET mime = 'text/tlnk', content = 'document', player = '' WHERE extension = 'tlnk'");
}
if (strpos($CONFIG['allowed_doc_types'], 'tlnk') === FALSE) {
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = CONCAT(value, '/tlnk') WHERE name = 'allowed_doc_types'");
}
return true;
}
// Thumbnail view
$thisplugin->add_filter('theme_display_thumbnails_params', 'tlnk_thumbnail_params');
function tlnk_thumbnail_params($params)
{
$file = file_get_contents(urldecode($CURRENT_PIC_DATA['url'])); // file.tlnk contains redirection URL
$CURRENT_PIC_DATA = 'Thumbnail link'; //or $CURRENT_PIC_DATA = '$file'; to show URL
$params['{THUMB}'] = '<div><object data="'.$file.'" type="text/tlnk"></object></div>';
}
return $params;
}
?>
-
According to what exactly your .tlnk files contains (e.g. a link to an image like http://coppermine-gallery.net/demo/cpg15x/albums/userpics/10002/thumb_muscari_rosee_25k.jpg), replace
$params['{THUMB}'] = '<div><object data="'.$file.'" type="text/tlnk"></object></div>';
with something like
$params['{THUMB}'] = '<img src="'.$file.'" />';