coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: Laurenzo on January 28, 2005, 01:41:53 AM

Title: Make a javascript directly on thumbail [resolved]
Post by: Laurenzo on January 28, 2005, 01:41:53 AM
Hello all

Coppermine is absolutly great, good job for all community and the team :)

I have a little website (in french but it's not important)

I would, launch the javascrip for open the image in new windows, directly after click on the thumbails.

Sample , now for launch javascript for open the image in new windows, it's in this url :

http://ordigamers.com/screens/displayimage.php?album=4&pos=0

Me, i would launch the javascript for open the image in new windows DIRECTLY at this URL, juste after the click on the thumbails.

http://ordigamers.com/screens/thumbnails.php?album=4 (it's more beautiful no ? ;-) )


It's possible ?

what is the file then you must modify for make that ?


if you can help me, i love you....

Thanks very much
Title: Re: Make a javascript directly on thumbail...
Post by: Abbas Ali on January 28, 2005, 07:59:48 AM
Do you want that full size image should open in a new window, when clicked on thumbnail? OR do you want that the intermediate image (displayimage.php) should open in a new window?
Title: Re: Make a javascript directly on thumbail...
Post by: Laurenzo on January 28, 2005, 02:54:42 PM
thank for your reply

i want that full size image should open in a new window, when clicked on thumbnail....

I have desactivate the intermediate image

thank you for your futur reply...
Title: Re: Make a javascript directly on thumbail...
Post by: Abbas Ali on January 29, 2005, 07:21:02 AM
For displaying full size image when clicked on thumbnail (Will be applied to all thumbnails and you will not be able to see intermediate image at all) -

In include/functions.inc.php

Add


$thumb_list[$i]['pid'] = $row['pid'];
$thumb_list[$i]['pwidth'] = $row['pwidth'];
$thumb_list[$i]['pheight'] = $row['pheight'];


immediately after (somewhere around line 1076 in function display_thumbnails.)


$thumb_list[$i]['aid'] = $row['aid'];


In themes/yourtheme/theme.php (You will have to make following changes in all the themes which you use)

($template_thumbnail_view template block) Replace


<a href="{LINK_TGT}">{THUMB}<br /></a>


with


<a href="{LINK_TGT}" onclick="{ON_CLICK}">{THUMB}<br /></a>


and replace (in function theme_display_thumbnails)


$params = array('{CELL_WIDTH}' => $cell_width,
    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}",
    '{THUMB}' => $thumb['image'],
    '{CAPTION}' => $thumb['caption'],
    '{ADMIN_MENU}' => $thumb['admin_menu']
    );


with


$params = array('{CELL_WIDTH}' => $cell_width,
    '{LINK_TGT}' => "javascript:;",
    '{ON_CLICK}' => "MM_openBrWindow('displayimage.php?pid=".$thumb['pid']."&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=".$thumb['pwidth'].",height=".$thumb['pheight']."')",
    '{THUMB}' => $thumb['image'],
    '{CAPTION}' => $thumb['caption'],
    '{ADMIN_MENU}' => $thumb['admin_menu']
    );


Enjoy. :)
Title: Re: Make a javascript directly on thumbail...
Post by: Laurenzo on January 31, 2005, 08:50:45 PM
thank you abbas ali, i wil ltry that....

;D
Title: Re: Make a javascript directly on thumbail...
Post by: Anne on February 02, 2005, 12:02:09 PM
I tried this, and it does what it's supposed to do except image views are no longer logged (as far as I can tell). Is there a way to have image views logged still?
Title: Re: Make a javascript directly on thumbail...
Post by: Abbas Ali on February 02, 2005, 01:28:08 PM
Views logging, commenting, voting, slideshow etc.. are all features on intermediate stage pic which we have skipped by showing directly the full size image.

However if you want that the views should be logged when showing full size image, it could be done by modifying the function display_fullsize_pic() in displayimage.php file.
Title: Re: Make a javascript directly on thumbail...
Post by: Anne on February 02, 2005, 04:06:57 PM
I'd like to continue logging views, but I don't know what I need to modify the function display_fullsize_pic() to.
Title: Re: Make a javascript directly on thumbail...
Post by: Laurenzo on February 02, 2005, 07:56:21 PM
I have triy that, and it's good !!

great manip' !!!

i you would see the result :

http://ordigamers.com/ordi/e107_plugins/coppermine_menu/thumbnails.php?album=5

Thank you abbas ali, i will never found that alone.....
Title: Re: Make a javascript directly on thumbail [resolved]
Post by: Anne on February 03, 2005, 02:52:12 AM
I took a guess at modifying the displayimage.php and this is what I did:

// Display the full size image
function display_fullsize_pic()
{
   global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET;
   global $lang_errors, $lang_fullsize_popup, $lang_charset;

   if (function_exists('theme_display_fullsize_pic')) {
       theme_display_fullsize_pic();
       return;
   }
   // Add 1 to hit counter
   if ($album != "lasthits" && !in_array($pid, $USER['liv']) && isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) {
       add_hit($pid);
       if (count($USER['liv']) > 4) array_shift($USER['liv']);
       array_push($USER['liv'], $pid);
   }


When I checked this, I got this in the pop-up:

Warning: in_array(): Wrong datatype for second argument in /home/public_html/gallery/displayimage.php on line 449

Also, I don't think it's logging hits still. Could someone help me with this?
Title: Re: Make a javascript directly on thumbail [resolved]
Post by: Abbas Ali on February 03, 2005, 06:48:01 AM
Replace above code with


// Display the full size image
function display_fullsize_pic()
{
    global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET, $USER, $HTTP_COOKIE_VARS;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;
   
    $pid = $HTTP_GET_VARS['pid'];
   
    // Add 1 to hit counter
    if (!in_array($pid, $USER['liv']) && isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) array_shift($USER['liv']);
        array_push($USER['liv'], $pid);
        user_save_profile();
    }

    if (function_exists('theme_display_fullsize_pic')) {
        theme_display_fullsize_pic();
        return;
    }


and you will be able to log the views.
Title: Re: Make a javascript directly on thumbail [resolved]
Post by: Anne on February 03, 2005, 03:52:23 PM
Thanks, it works perfectly.
Title: Re: Make a javascript directly on thumbail [resolved]
Post by: crippe on February 23, 2005, 09:38:04 PM
Hi Abbas Ali,

Thanks for a great mod !!! But I have 1 problem  :\'( I get this when I try it

Warning: in_array(): Wrong datatype for second argument in /web/sites/chrisus/thaichix.com/members/coppermine/displayimage.php on line 438

Warning: array_push(): First argument should be an array in /web/sites/chrisus/thaichix.com/members/coppermine/displayimage.php on line 441


Please advice

Sincerely

Crippe


Quote from: Abbas Ali on February 03, 2005, 06:48:01 AM
Replace above code with


// Display the full size image
function display_fullsize_pic()
{
    global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET, $USER, $HTTP_COOKIE_VARS;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;
   
    $pid = $HTTP_GET_VARS['pid'];
   
    // Add 1 to hit counter
    if (!in_array($pid, $USER['liv']) && isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) array_shift($USER['liv']);
        array_push($USER['liv'], $pid);
        user_save_profile();
    }

    if (function_exists('theme_display_fullsize_pic')) {
        theme_display_fullsize_pic();
        return;
    }


and you will be able to log the views.
Title: Re: Make a javascript directly on thumbail [resolved]
Post by: Abbas Ali on February 24, 2005, 06:26:20 AM
Add this code


if (!isset($USER['liv']) || !is_array($USER['liv'])) {
    $USER['liv'] = array();
}


just after

$pid = $HTTP_GET_VARS['pid'];


in above code. And everything should work hopefully. :)
Title: Re: Make a javascript directly on thumbail [resolved]
Post by: crippe on February 24, 2005, 11:21:47 AM
Thanks alot!!!!!!!!!