Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Thumbnail click - redirection to external page  (Read 5163 times)

0 Members and 1 Guest are viewing this topic.

kwszp

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Thumbnail click - redirection to external page
« on: February 04, 2011, 04:39:44 pm »

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   :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Thumbnail click - redirection to external page
« Reply #1 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.
Logged

kwszp

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Thumbnail click - redirection to external page
« Reply #2 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]
<?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;
}

?>

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Thumbnail click - redirection to external page
« Reply #3 on: February 09, 2011, 09:09:19 am »

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
Code: [Select]
$params['{THUMB}'] = '<div><object data="'.$file.'" type="text/tlnk"></object></div>';with something like
Code: [Select]
$params['{THUMB}'] = '<img src="'.$file.'" />';
Logged
Pages: [1]   Go Up
 

Page created in 0.049 seconds with 20 queries.