source: extensions/imgpreview/main.inc.php @ 11079

Last change on this file since 11079 was 11079, checked in by flop25, 13 years ago

first commit :
works but may need to restrict the dimension

File size: 1.7 KB
Line 
1<?php
2/*
3Plugin Name: Image Preview
4Version: auto
5Description: give an image preview when the mouve is over a thumbnail
6Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=
7Author: Flop25
8Author URI: http://www.planete-flop.fr/
9*/
10
11/** thumbnails.tpl **/
12add_event_handler('loc_end_index_thumbnails', 'imgpreview_thumbnails');
13function imgpreview_thumbnails($tpl_thumbnails_var)
14{
15        global $template;
16        $template->set_prefilter('index_thumbnails', 'imgpreview_prefilter_thumbnails');
17        $template->set_prefilter('stuffs', 'imgpreview_prefilter_thumbnails');
18        /*
19        $UrlJs = get_root_url().'plugins/imgpreview/js/imgpreview.js';
20        $UrlCss = get_root_url().'plugins/imgpreview/css/imgpreview.css';
21        $template->append(
22        'head_elements',
23        '<script type="text/javascript" src="'.$UrlJs.'"></script>'."\n".
24        "\t".'<link rel="stylesheet" type="text/css" href="'.$UrlCss.'">'."\n"
25        );
26        $template->append(
27        'footer_elements',
28        '<script type="text/javascript" src="'.get_root_url().'plugins/imgpreview/js/init.js"></script>'."\n"
29        );
30        */
31        $dir=dirname(__FILE__).'/css_js.tpl';
32        $template->set_filenames(array(
33                'imgpreview_css_js' => realpath($dir),
34          )  );
35        //die('_'.realpath($dir).'_');
36        //$imgpreview_css_js = $template->parse('imgpreview_css_js', true);
37        $template->assign_var_from_handle('IMGPREVIEW', 'imgpreview_css_js');
38
39        //define('IMGPREVIEW',$imgpreview_css_js);
40        //die(IMGPREVIEW);
41        return $tpl_thumbnails_var;
42}
43
44function imgpreview_prefilter_thumbnails($content, &$smarty)
45{
46        global $template;
47  $search = 'href="{$thumbnail.URL}"';
48 
49  $replacement = 'href="{$thumbnail.URL}" imgsrc="{$thumbnail.FILE_PATH}"';
50
51  $content= str_replace($search, $replacement, $content);
52
53        $content='{$IMGPREVIEW}'.$content;
54        return $content;
55}
56?>
Note: See TracBrowser for help on using the repository browser.