[ PHPXref.com ] [ Generated: Sun Jul 20 20:03:19 2008 ] [ Pixelpost 1.4.3 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/includes/ -> 12cropimageincscripts.php (source)

   1  <?php
   2  ////////////////////////////////////////////////////////////////////////////////////////////////////

   3  //////////////////////////                                                //////////////////////////

   4  //////////////////////////                 1 2 CROP IMAGE                 //////////////////////////

   5  //////////////////////////                                                //////////////////////////

   6  //////////////////////////             (c) 2002 Roel Meurders             //////////////////////////

   7  //////////////////////////         mail: scripts@roelmeurders.com         //////////////////////////

   8  //////////////////////////                  version 0.2                   //////////////////////////

   9  //////////////////////////                                                //////////////////////////

  10  ////////////////////////////////////////////////////////////////////////////////////////////////////

  11  ///// CREDITS: Most Javascript is taken from DHTMLCentral.com and is made by Thomas Brattli. ///////

  12  ////////////////////////////////////////////////////////////////////////////////////////////////////

  13  ////////////////////////////////////////////////////////////////////////////////////////////////////

  14  ///// Modified by:   Ramin Mehran @ March 2005

  15  ///// Modifications: Modified substantially to make it

  16  /////                 compatible with Pixelpost v1.4 (Pixelpost.org) and the original php

  17  /////                 file has been broken into seperated parts.

  18  ////////////////////////////////////////////////////////////////////////////////////////////////////

  19  
  20  echo  '  <script type="text/javascript" src="' .$javafile .'"></script>';
  21  
  22  //require("pixelpost.php");

  23  /* start up mysql */

  24  mysql_error();
  25  
  26  // save new post when '12c' is selected as the croping tool

  27  
  28      $cfgquery = mysql_query("select * from ".$pixelpost_db_prefix."config");
  29      $cfgrow = mysql_fetch_array($cfgquery);
  30  if(($_GET['x'] == "save" || ($_GET['view']=="images" && $_GET['id']!=""))&& $cfgrow['crop']=='12c' ) {
  31      $headline =     clean($_POST['headline']);
  32      if($headline == "" & $_GET['view']!="images") {
  33      echo "
  34      <div id='cropdiv'></div>
  35      <div id='myimg'></div>";
  36  
  37      }
  38  
  39  
  40  // put these jscripts on the html section

  41      echo "
  42      <script type='text/javascript'  >
  43  	function libinit(){
  44         obj=new lib_obj('cropdiv');
  45         obj.dragdrop();
  46         rimg = new lib_obj('myimg');
  47      }
  48  
  49  	function cropCheck(crA,thumbfilename){
  50         if (
  51         ( (obj.x ) <=rimg.cr+ rimg.x)&&
  52         ( (obj.y ) <= rimg.cb+rimg.y)&&
  53         (obj.x >= rimg.x)&&
  54         (obj.y >= rimg.y)&&
  55         (obj.x+obj.cr<=rimg.cr+rimg.x)&&
  56         (obj.y+obj.cb<=rimg.cb+rimg.y)
  57         )
  58          {
  59          var url = '?x=12cropthumb&sw='+(obj.x-rimg.x)+'&sh='+(obj.y-rimg.y)+'&dw='+obj.cr+'&dh='+obj.cb+'&filename='+thumbfilename;
  60          if (crA == 'def'){
  61             location.href=url;
  62          }
  63         } else {
  64          alert('".$txt['selectioninpicture']."' );
  65  
  66         }
  67      }
  68  
  69  	function stopZoom() {
  70         loop = false;
  71         clearTimeout(zoomtimer);
  72      }
  73  
  74  	function cropZoom(dir){
  75          zoomtimer = null;
  76         loop = true;
  77         prop = ".$crh." / ".$crw.";
  78  
  79         direction = dir;
  80         if (loop == true) {
  81          if (direction == 'in') {
  82             if ((obj.cr > " .$crw/$imgProp .")&&(obj.cb > " .$crh/$imgProp.")){
  83              cW = obj.cr - 1;
  84              cH = parseInt(prop * cW);
  85              obj.clipTo(0,cW,cH,0,1);
  86             }
  87          } else {
  88             if ((obj.cr < (rimg.cr-2))&&
  89             (obj.cb < (rimg.cr-2))
  90             ){
  91              cW = obj.cr + 1;
  92              cH = parseInt(prop * cW);
  93              obj.clipTo(0,cW,cH,0,1);
  94             }
  95          }
  96          zoomtimer = setTimeout('cropZoom(direction)', 10);
  97         }
  98      }
  99      onload = libinit;
 100          </script>";
 101      }
 102      // necessary styles

 103      $toecho = "
 104      <style type='text/css'>
 105      #cropdiv{position:absolute;  width:($crw/$imgProp)px; height:($crh/$imgProp)px; z-index:2; background-image: url($spacer); }

 106      #myimg{position:absolute;border:1px}

 107      </style>";
 108  
 109      echo $toecho; // add necessary styles to the admin/index.php

 110  
 111  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]