Thumbnail click - redirection to external page Thumbnail click - redirection to external page
 

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

Main Menu

Thumbnail click - redirection to external page

Started by kwszp, February 04, 2011, 04:39:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kwszp

Hello,
There was a similar request (Clickable link in thumbnail view) 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.

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), 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 and I thought, that maybe modifying it to accept something like <lnk> files, containing an url, with thumbnails loaded with custom thumbnail plugin would do the job?

Any help much appreciated   :)

Αndré

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.

kwszp

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;
}

?>



Αndré

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.'" />';