Login   Register  
PHP Classes
elePHPant
Icontem

File: inc.cropjavascript.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrew Collington  >  Crop Canvas  >  inc.cropjavascript.php  >  Download  
File: inc.cropjavascript.php
Role: Auxiliary script
Content type: text/plain
Description: Initiates elements to be handled by javascript.
Class: Crop Canvas
A class to crop images in a variety of ways.
Author: By
Last change:
Date: 7 years ago
Size: 1,370 bytes
 

Contents

Class file image Download
<?php

/**
 * $Id: inc.cropjavascript.php 49 2006-11-29 14:35:46Z Andrew $
 *
 * [Description]
 *
 * Required file for class.cropinterface.php.
 *
 * [Author]
 *
 * Andrew Collington <php@amnuts.com> <http://php.amnuts.com/>
 */

list($w$h) = $this->calculateCropDimensions($this->crop['default']);
list(
$x$y) = $this->calculateCropPosition($w$h);

?>

<script type="text/javascript">
    SET_DHTML("theCrop"+MAXOFFLEFT+0+MAXOFFRIGHT+<?php echo $this->getImageWidth(); ?>+MAXOFFTOP+0+MAXOFFBOTTOM+<?php echo $this->getImageHeight(), ($this->crop['resize'] ? '+RESIZABLE' ''); ?>+MAXWIDTH+<?php echo $this->getImageWidth(); ?>+MAXHEIGHT+<?php echo $this->getImageHeight(); ?>+MINHEIGHT+<?php echo $this->crop['min-height']; ?>+MINWIDTH+<?php echo $this->crop['min-width']; ?>,"theImage"+NO_DRAG,"cropDimensions"+NO_DRAG);

    dd.elements.theCrop.moveTo(dd.elements.theImage.x + <?php echo $x?>, dd.elements.theImage.y + <?php echo $y?>);
    dd.elements.theCrop.setZ(dd.elements.theImage.z+1);
    dd.elements.theImage.addChild("theCrop");
    dd.elements.theCrop.defx = dd.elements.theImage.x;
    dd.elements.theCrop.defy = dd.elements.theImage.y;
    dd.elements.theImage.setOpacity(0.3);

    <?php if ($this->crop['resize']) { echo 'cc_SetResizingType(', (string)$this->crop['type'], ');'; } ?>
    cc_showCropSize();
    cc_reposBackground();
</script>