cvs: pear /Image_Transform/Drivers GD.php IM.php NetPBM.php
| From: | Peter Bowyer | Date: | Mon, 19 Aug 2002 18:41:29 +0000 |
| Subject: | cvs: pear /Image_Transform/Drivers GD.php IM.php NetPBM.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5814@lists.php.net to get a copy of this message | ||
reywob Mon Aug 19 14:41:29 2002 EDT
Modified files:
/pear/Image_Transform/Drivers GD.php IM.php NetPBM.php
Log:
Removed the _get_size() and _get_type() methods from these files, as these are now in the main
file. Other misc. changes
Index: pear/Image_Transform/Drivers/GD.php
diff -u pear/Image_Transform/Drivers/GD.php:1.2 pear/Image_Transform/Drivers/GD.php:1.3
--- pear/Image_Transform/Drivers/GD.php:1.2 Fri Jul 5 02:50:25 2002
+++ pear/Image_Transform/Drivers/GD.php Mon Aug 19 14:41:29 2002
@@ -16,7 +16,7 @@
// | Alan Knowles <alan@akbkhome.com> |
// +----------------------------------------------------------------------+
//
-// $Id: GD.php,v 1.2 2002/07/05 06:50:25 reywob Exp $
+// $Id: GD.php,v 1.3 2002/08/19 18:41:29 reywob Exp $
//
// Image Transformation interface using the GD library
//
@@ -61,10 +61,10 @@
function load($image)
{
$this->image = $image;
- $this->type = $this->_get_type();
+ $this->_get_image_details($image);
$functionName = 'ImageCreateFrom' . $this->type;
$this->imageHandle = $functionName($this->image);
- $this->_get_size();
+
} // End load
@@ -89,6 +89,28 @@
}
} // End addText
+ function rotate($angle)
+ {
+ if ('-' == $angle{0}) {
+ $angle = 360 - substr($angle, 1);
+ }
+ $size = GetImageSize($img_sorgente);
+ $tot_x = $this->img_x;
+ $tot_y = $this->img_y;
+
+ $img_risulta = ImageCreate ($tot_y,$tot_x)
+
+ $img_sorgente=ImageCreateFromJpeg($img_sorgente);
+
+ for($i_x=0;$i_x<$tot_x;$i_x++){
+ for($i_y=0;$i_y<$tot_y;$i_y++){
+ $ris_x=$tot_y-($i_y+1);
+ $ris_y=$i_x;
+ imagecopy($img_risulta, $img_sorgente, $ris_x,$ris_y,$i_x,$i_y,1,1);
+ } // Y
+ } // X
+
+ }
/**
* Resize Action
*
@@ -156,40 +178,6 @@
ImageDestroy($this->imageHandle);
}
}
-
- /**
- * get the image type
- *
- * @return string (gif,jpeg,png)
- */
- function _get_type () { // Can I pass $image by reference?
- $data = GetImageSize($this->image);
-
- switch($data[2]){
- case '1':
- $type = 'gif';
- break;
- case '2':
- $type = 'jpeg';
- break;
- case '3':
- $type = 'png';
- break;
- }
- return $type;
- }
-
- /**
- * get the image size (into img_x and img_y)
- *
- * @return none
- */
- function _get_size()
- {
- $size = GetImageSize($this->image);
- $this->img_x = $size[0];
- $this->img_y = $size[1];
- } // End _get_size
} // End class ImageIM
?>
Index: pear/Image_Transform/Drivers/IM.php
diff -u pear/Image_Transform/Drivers/IM.php:1.2 pear/Image_Transform/Drivers/IM.php:1.3
--- pear/Image_Transform/Drivers/IM.php:1.2 Fri Jul 5 02:50:25 2002
+++ pear/Image_Transform/Drivers/IM.php Mon Aug 19 14:41:29 2002
@@ -15,7 +15,7 @@
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
// +----------------------------------------------------------------------+
//
-// $Id: IM.php,v 1.2 2002/07/05 06:50:25 reywob Exp $
+// $Id: IM.php,v 1.3 2002/08/19 18:41:29 reywob Exp $
//
// Image Transformation interface using command line ImageMagick
//
@@ -42,7 +42,7 @@
define('IMAGE_TRANSFORM_LIB_PATH',
escapeshellcmd(System_Command::which('convert')) . '/');
}
return true;
- } // End function Image_IM
+ } // End Image_IM
/**
* Load image
@@ -58,10 +58,7 @@
return PEAR::raiseError('The image file ' . $image . ' does\'t
exist', true);
}
$this->image = $image;
- $this->_get_size();
- // Should the image type be lower or upper case?
- exec(IMAGE_TRANSFORM_LIB_PATH . 'identify -format "%m" ' . $image,
$data);
- $this->type = strtolower($data[0]);
+ $this->_get_image_details($image);
} // End load
/**
@@ -87,6 +84,9 @@
*/
function rotate($angle)
{
+ if ('-' == $angle{0}) {
+ $angle = 360 - substr($angle, 1);
+ }
$this->command['rotate'] = "-rotate $angle";
} // End rotate
@@ -159,19 +159,6 @@
{
return true;
}
-
- /**
- * get the image size (into img_x and img_y)
- *
- * @return none
- */
- function _get_size()
- {
- $str = exec(IMAGE_TRANSFORM_LIB_PATH . "identify -format \"%w::%h\" " .
$this->image, $data);
- $str = split('::', $data[0]);
- $this->img_x = $str[0];
- $this->img_y = $str[1];
- } // End _get_size
-
+
} // End class ImageIM
?>
Index: pear/Image_Transform/Drivers/NetPBM.php
diff -u pear/Image_Transform/Drivers/NetPBM.php:1.3 pear/Image_Transform/Drivers/NetPBM.php:1.4
--- pear/Image_Transform/Drivers/NetPBM.php:1.3 Fri Jul 5 02:50:25 2002
+++ pear/Image_Transform/Drivers/NetPBM.php Mon Aug 19 14:41:29 2002
@@ -15,7 +15,7 @@
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
// +----------------------------------------------------------------------+
//
-// $Id: NetPBM.php,v 1.3 2002/07/05 06:50:25 reywob Exp $
+// $Id: NetPBM.php,v 1.4 2002/08/19 18:41:29 reywob Exp $
//
// Image Transformation interface using command line NetPBM
//
@@ -55,8 +55,7 @@
define('IMAGE_TRANSFORM_LIB_PATH',
escapeshellcmd(System_Command::which('pnmscale')) . '/');
}
$this->image = $image;
- $this->type = $this->_get_type();
- $this->_get_size();
+ $this->_get_image_details($image);
} // End load
/**
@@ -177,44 +176,6 @@
return true;
}
- /**
- * get the image size (into img_x and img_y)
- *
- * @return none
- */
- function _get_size()
- {
- $size = GetImageSize($this->image);
- $this->_set_img_x($size[0]);
- $this->_set_img_y($size[1]);
- } // End _get_size
-
-
- /**
- * get the image type
- *
- * @return string (gif,jpeg,png)
- */
- function _get_type() { // Should I pass $image by reference?
- $data = GetImageSize($this->image);
-
- switch($data[2]){
- case '1':
- $type = 'gif';
- break;
- case '2':
- $type = 'jpeg';
- break;
- case '3':
- $type = 'png';
- break;
- case 7:
- case 8:
- $type='tiff';
- break;
- }
- return $type;
- }
} // End class ImageIM
?>