45 lines
919 B
PHP
45 lines
919 B
PHP
<?php
|
|
|
|
|
|
abstract class phImaginator_Rotate extends phImaginator_Universal implements phImaginator_Module {
|
|
|
|
protected static $runCollected = false;
|
|
|
|
|
|
public static function degree($angle, $color = '#000000', $opacity = 100) {
|
|
$image_data =& parent::getCurrentResource();
|
|
|
|
$bgcolor = parent::transparency($image_data['resource'], $color, $opacity);
|
|
|
|
$image_data['resource'] = imagerotate($image_data['resource'], $angle, $bgcolor, true);
|
|
|
|
$image_data['width'] = imagesx($image_data['resource']);
|
|
$image_data['height'] = imagesy($image_data['resource']);
|
|
}
|
|
|
|
|
|
public static function landscape() {
|
|
$image_data =& parent::getCurrentResource();
|
|
|
|
if ($image_data['width'] < $image_data['height']) {
|
|
self::degree(270);
|
|
}
|
|
}
|
|
|
|
|
|
public static function portrait() {
|
|
$image_data =& parent::getCurrentResource();
|
|
|
|
if ($image_data['width'] > $image_data['height']) {
|
|
self::degree(90);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|