Zoom in out ? plugin? - Page 2 Zoom in out ? plugin? - Page 2
 

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]

Main Menu

Zoom in out ? plugin?

Started by brad4edat, October 12, 2011, 11:02:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brad4edat

Hello again, I made changes to the file plugin codebase.php of ANIS.
Changes are lines:


121 - applet_tag1 = '<PARAM name=\"image_window_size\" value=\"1280,800"> \ n';

123 - applet_tag = applet_tag2 + applet_tag1;

Now is not a big zoom 100% and starts as it should be, but still frame image remains larger than the screen.
Help to correct code with the guidance of TOM.

See how the photos are now open:
http://3d-universe.net/Gallery/displayimage.php?pid=953&fullsize=1



<?php
/**************************************************
  Coppermine 1.5.x Plugin - CPGAnis
  *************************************************
  Copyright (c) 2011 eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$thisplugin->add_action('page_start','anis');

function 
anis() {
    global 
$ALBUM_SET,$cat,$CONFIG;
    
$superCage Inspekt::makeSuperCage();

    if (
$superCage->get->keyExists('fullsize') && defined('DISPLAYIMAGE_PHP')) {
        if (!
USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
            
$redirect $redirect "login.php";
            
header("Location: $redirect");
            exit();
        }
        
$cat $superCage->get->keyExists('cat') ? $superCage->get->getInt('cat') : 0;        
        
get_meta_album_set($cat,$ALBUM_SET);
        
anis_display_fullsize_pic();
        
ob_end_flush();
        exit();
    }
}

// Display the full size image
function anis_display_fullsize_pic() {
    global 
$CONFIG$THEME_DIR$ALBUM_SET;
    global 
$lang_errors$lang_fullsize_popup$lang_charset;
    
$superCage Inspekt::makeSuperCage();

    if (
$superCage->get->keyExists('picfile')) {
        if (!
GALLERY_ADMIN_MODE) {
            
cpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
        }

        
$picfile $superCage->get->getRaw('picfile');
        
$picname $CONFIG['fullpath'] . $picfile;
        
$imagesize = @getimagesize($picname);
        
$imagedata = array('name' => $picfile'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif (
$superCage->get->keyExists('pid')) {
        
$pid $superCage->get->getInt('pid');
        
$sql "SELECT * " "FROM {$CONFIG['TABLE_PICTURES']} " "WHERE pid='$pid$ALBUM_SET";
        
$result cpg_db_query($sql);

        if (!
mysql_num_rows($result)) {
            
cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);
        }

        
$row mysql_fetch_array($result);
        
$pic_url get_pic_url($row'fullsize');
        
$geom 'width="' $row['pwidth'] . '" height="' $row['pheight'] . '"';
        
$imagedata = array('name' => $row['filename'], 'path' => $pic_url'geometry' => $geom);
    }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <script type="text/javascript">
  function adjust_popup()
{
        var w, h, fixedW, fixedH, diffW, diffH;
        if (document.documentElement && document.body.clientHeight==0) {     // Catches IE6 and FF in DOCMODE
                fixedW = document.documentElement.clientWidth;
                fixedH = document.documentElement.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.documentElement.clientWidth;
                diffH = fixedH - document.documentElement.clientHeight;
                w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE.
                h = fixedH + diffH;
                if (w >= screen.availWidth) h += 16;
        } else if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (h >= screen.availHeight) w += 16;
                if (w >= screen.availWidth)  h += 16;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (w >= screen.availWidth)  h += 16;
                if (h >= screen.availHeight) w += 16;
        }
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        // full size hack - START
        w = <?php echo $row['pwidth']; ?>;
        h = <?php echo $row['pheight']; ?>;
        // full size hack - END
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
       // alert('<!-- width: ' + w + ' height: ' + h + ' --> ');
       //applet_tag='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"' + w + '\" height=\"' + h + '\">';
       applet_tag1='<PARAM name=\"image_window_size\" value=\"1280,800">\n';
       applet_tag2='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"'+ (w-diffW-5) +'\" height=\"' + (h-diffH-7) + '\">\n';
       applet_tag=applet_tag2+applet_tag1;
}
  </script>
  <style type="text/css">
  body { margin: 0; padding: 0; background-color: gray; }
  img { margin:0; padding:0; border:0; }
  #content { margin:0 auto; padding:0; border:0; }
  table { border:0; height:100%; width:100%; border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  applet {border:0, margin:0; padding:0;}
  </style>
  </head>
  <body>
   <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
   </script>
    <table>
      <tr>
            <td>
          <div id="content">
                <script language="JavaScript" type="text/JavaScript">
                 document.write(applet_tag);
                </script>
               <PARAM name="active_zoom" value="x">

              <?php
              
           
echo ' <PARAM name="filenames" value="'
                
htmlspecialchars($imagedata['path']) . '"> '

               
?>

                 </APPLET>
          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

?>

brad4edat

Hello again:)

After many attempts, I managed to adjust almost perfectly as I want the gallery. Images open and zoom almost like I want.

Here's a look at Link - http://3d-universe.net/Gallery/displayimage.php?album=lastup&cat=0&pid=971 # top_display_media
The picture format is 16x9 4320x2432px - original resolution.

Gotcha code plugin - CPGanis / codebase.php
and changed lines 121/122/123
(Applet_tag1 = '<PARAM name=\"image_window_size\" value=\"1258,690"> \ n';

       applet_tag2 = '<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"1280" height=\"710"> \ n';

       applet_tag = applet_tag2 + applet_tag1;)
so that the proportions to be responsible for images with a resolution of 16x9!


But pictures are not 16x9 resolution, open with incorrect proportions!
http://3d-universe.net/Gallery/displayimage.php?album=4&pid=350 # top_display_media
Apparently, the code must be converted to work% rather than px.
I tried to write it to work with%, but failed. Just image does not load when working with%.


Would you rewritten these lines to work with%, so the 4x3 resolution images are not blurry, but it is important to 16x9 display properly!


Processing code, the plugin will be very useful for users of coppermine gallery, I'm sure:))

Sincere thanks to Tom Whittaker!!! I thank him much for your time and attention, a great guy:))



CPGanis new code -->   codebase.php
<?php
/**************************************************
  Coppermine 1.5.x Plugin - CPGAnis
  *************************************************
  Copyright (c) 2011 eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$thisplugin->add_action('page_start','anis');

function 
anis() {
    global 
$ALBUM_SET,$cat,$CONFIG;
    
$superCage Inspekt::makeSuperCage();

    if (
$superCage->get->keyExists('fullsize') && defined('DISPLAYIMAGE_PHP')) {
        if (!
USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
            
$redirect $redirect "login.php";
            
header("Location: $redirect");
            exit();
        }
        
$cat $superCage->get->keyExists('cat') ? $superCage->get->getInt('cat') : 0;        
        
get_meta_album_set($cat,$ALBUM_SET);
        
anis_display_fullsize_pic();
        
ob_end_flush();
        exit();
    }
}

// Display the full size image
function anis_display_fullsize_pic() {
    global 
$CONFIG$THEME_DIR$ALBUM_SET;
    global 
$lang_errors$lang_fullsize_popup$lang_charset;
    
$superCage Inspekt::makeSuperCage();

    if (
$superCage->get->keyExists('picfile')) {
        if (!
GALLERY_ADMIN_MODE) {
            
cpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
        }

        
$picfile $superCage->get->getRaw('picfile');
        
$picname $CONFIG['fullpath'] . $picfile;
        
$imagesize = @getimagesize($picname);
        
$imagedata = array('name' => $picfile'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif (
$superCage->get->keyExists('pid')) {
        
$pid $superCage->get->getInt('pid');
        
$sql "SELECT * " "FROM {$CONFIG['TABLE_PICTURES']} " "WHERE pid='$pid$ALBUM_SET";
        
$result cpg_db_query($sql);

        if (!
mysql_num_rows($result)) {
            
cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);
        }

        
$row mysql_fetch_array($result);
        
$pic_url get_pic_url($row'fullsize');
        
$geom 'width="' $row['pwidth'] . '" height="' $row['pheight'] . '"';
        
$imagedata = array('name' => $row['filename'], 'path' => $pic_url'geometry' => $geom);
    }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <script type="text/javascript">
  function adjust_popup()
{
        var w, h, fixedW, fixedH, diffW, diffH;
        if (document.documentElement && document.body.clientHeight==0) {     // Catches IE6 and FF in DOCMODE
                fixedW = document.documentElement.clientWidth;
                fixedH = document.documentElement.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.documentElement.clientWidth;
                diffH = fixedH - document.documentElement.clientHeight;
                w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE.
                h = fixedH + diffH;
                if (w >= screen.availWidth) h += 16;
        } else if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (h >= screen.availHeight) w += 16;
                if (w >= screen.availWidth)  h += 16;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (w >= screen.availWidth)  h += 16;
                if (h >= screen.availHeight) w += 16;
        }
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        // full size hack - START
        w = <?php echo $row['pwidth']; ?>;
        h = <?php echo $row['pheight']; ?>;
        // full size hack - END
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
       // alert('<!-- width: ' + w + ' height: ' + h + ' --> ');
       //applet_tag='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"' + w + '\" height=\"' + h + '\">';
       applet_tag1='<PARAM name=\"image_window_size\" value=\"1258,690">\n';
       applet_tag2='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"1280" height=\"710">\n';
       applet_tag=applet_tag2+applet_tag1;
}
  </script>
  <style type="text/css">
  body { margin: 0; padding: 0; background-color: gray; }
  img { margin:0; padding:0; border:0; }
  #content { margin:0 auto; padding:0; border:0; }
  table { border:0; height:100%; width:100%; border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  applet {border:0, margin:0; padding:0;}
  </style>
  </head>
  <body>
   <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
   </script>
    <table>
      <tr>
            <td>
          <div id="content">
                <script language="JavaScript" type="text/JavaScript">
                 document.write(applet_tag);
                </script>
               <PARAM name="active_zoom" value="x">

              <?php
              
           
echo ' <PARAM name="filenames" value="'
                
htmlspecialchars($imagedata['path']) . '"> '

               
?>

                 </APPLET>
          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

?>

Αndré

Please try the latest plugin version from the SVN repository. It don't use fixed values and also keeps the picture ratio (which your current plugin version doesn't, as you can see here: http://3d-universe.net/Gallery/displayimage.php?pid=350).

brad4edat

Thanks Andre, now everything is fine.
But it is very strange because when before I lost 2-3 days entire SVN rar archive to Plugins, and took it ANIS, had these problems.

Now if only I downloaded SVN version of the plugin itself ANIS, everything is fine?

A lot of interesting ?!
But anyway, now when everything fell into place:)

Αndré

I updated the plugin code in the SVN repository several times in the meanwhile.

Αndré