Make a javascript directly on thumbail [resolved] Make a javascript directly on thumbail [resolved]
 

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

Make a javascript directly on thumbail [resolved]

Started by Laurenzo, January 28, 2005, 01:41:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Laurenzo

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

Abbas Ali

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?
Chief Geek at Ranium Systems

Laurenzo

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...

Abbas Ali

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. :)
Chief Geek at Ranium Systems

Laurenzo


Anne

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?

Abbas Ali

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.
Chief Geek at Ranium Systems

Anne

I'd like to continue logging views, but I don't know what I need to modify the function display_fullsize_pic() to.

Laurenzo

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.....

Anne

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?

Abbas Ali

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.
Chief Geek at Ranium Systems

Anne


crippe

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.

Abbas Ali

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. :)
Chief Geek at Ranium Systems

crippe