Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: kwszp on February 04, 2011, 04:39:44 pm

Title: Thumbnail click - redirection to external page
Post by: kwszp on February 04, 2011, 04:39:44 pm
There was a similar request (Clickable link in thumbnail view (,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 (,22564.0.html).

A clickable thumbnail (equivalent of <a target="_blank" alt="caption" href=""><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 (, 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 (,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 (,60272.0.html) would do the job?

Any help much appreciated   :)
Title: Re: Thumbnail click - redirection to external page
Post by: Αndré on February 07, 2011, 12:52:35 pm
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.
Title: Re: Thumbnail click - redirection to external page
Post by: kwszp on February 08, 2011, 10:59:36 pm
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  ;)
Code: [Select]

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');


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'");

// Thumbnail view

$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>';



Title: Re: Thumbnail click - redirection to external page
Post by: Αndré on February 09, 2011, 09:09:19 am
According to what exactly your .tlnk files contains (e.g. a link to an image like, replace
Code: [Select]
$params['{THUMB}'] = '<div><object data="'.$file.'" type="text/tlnk"></object></div>';with something like
Code: [Select]
$params['{THUMB}'] = '<img src="'.$file.'" />';