当前位置: 首页>>代码示例>>PHP>>正文


PHP imagick_rotate函数代码示例

本文整理汇总了PHP中imagick_rotate函数的典型用法代码示例。如果您正苦于以下问题:PHP imagick_rotate函数的具体用法?PHP imagick_rotate怎么用?PHP imagick_rotate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imagick_rotate函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rotate

 function rotate($angle)
 {
     $this->_load_data();
     if ($this->data) {
         imagick_rotate($this->data, -$angle);
         return true;
     } else {
         return false;
     }
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:10,代码来源:imagick_old.php

示例2: __rotate

 /**
  * Rotate the image clockwise
  *
  * @param Asido_TMP &$tmp
  * @param float $angle
  * @param Asido_Color &$color
  * @return boolean
  * @access protected
  */
 function __rotate(&$tmp, $angle, &$color)
 {
     // skip full loops
     //
     if ($angle % 360 == 0) {
         return true;
     }
     $a = $tmp->image_height;
     $b = $tmp->image_width;
     // do the virtual `border`
     //
     $c = $a * cos(deg2rad($angle)) * sin(deg2rad($angle));
     $d = $b * cos(deg2rad($angle)) * sin(deg2rad($angle));
     // do the rest of the math
     //
     $a2 = $b * sin(deg2rad($angle)) + $a * cos(deg2rad($angle));
     $b2 = $a * sin(deg2rad($angle)) + $b * cos(deg2rad($angle));
     $a3 = 2 * $d + $a;
     $b3 = 2 * $c + $b;
     $a4 = $b3 * sin(deg2rad($angle)) + $a3 * cos(deg2rad($angle));
     $b4 = $a3 * sin(deg2rad($angle)) + $b3 * cos(deg2rad($angle));
     // create the `border` canvas
     //
     $t = $this->__canvas($b + 2 * $c, $a + 2 * $d, $color);
     // copy the image
     //
     imagick_composite($t->target, IMAGICK_COMPOSITE_OP_OVER, $tmp->target, $c, $d);
     // rotate the whole thing
     //
     imagick_rotate($t->target, $angle);
     // `final` result
     //
     $f = $this->__canvas($b2, $a2, $color);
     imagick_composite($f->target, IMAGICK_COMPOSITE_OP_OVER, $t->target, -(floor($b4) - $b2) / 2, -(floor($a4) - $a2) / 2);
     $this->__destroy_target($t);
     $this->__destroy_target($tmp);
     $tmp->target = $f->target;
     $tmp->image_width = $b2;
     $tmp->image_height = $a2;
     return true;
 }
开发者ID:TiMoChao,项目名称:xingfu,代码行数:50,代码来源:class.driver.imagick_ext_hack.php

示例3: rotate

 /**
  * Rotates the current image
  * Note: color mask are currently not supported
  *
  * @param   int     Rotation angle in degree
  * @param   array   No options are currently supported
  *
  * @return bool|PEAR_Error TRUE or a PEAR_Error object on error
  * @access public
  */
 function rotate($angle, $options = null)
 {
     if ($angle % 360 == 0) {
         return true;
     }
     if (!imagick_rotate($this->imageHandle, $angle)) {
         return $this->raiseError('Cannot create a new imagick image for the rotation.', IMAGE_TRANSFORM_ERROR_FAILED);
     }
     $this->new_x = imagick_getwidth($this->imageHandle);
     $this->new_y = imagick_getheight($this->imageHandle);
     return true;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:22,代码来源:Imagick2.php

示例4: rotateimage

 /**
  * @param $angle
  */
 function rotateimage($angle)
 {
     if ($this->uselib == "imagick") {
         //Imagick and GD have different opinion what is 90 degree. right or left?
         imagick_rotate($this->imagehandle, -$angle);
     } else {
         if ($this->uselib == "gd") {
             if ($this->gdversion > 2.0) {
                 //I know, it's PHP <= 4.3.0. It destroys images if u try to rotate them
                 $this->imagehandle = imagerotate($this->imagehandle, $angle, 0);
             }
         }
     }
     // update the $this->image
     $this->writeimagetostring();
     //get new sizex, sizey
     $this->oldxsize = $this->xsize;
     $this->oldysize = $this->ysize;
     $this->getimageinfo();
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:23,代码来源:imagegallib.php

示例5: __rotate

 /**
  * Rotate the image clockwise: only rectangular rotates are supported (90,180,270)
  *
  * @param Asido_TMP &$tmp
  * @param float $angle
  * @param Asido_Color &$color
  * @return boolean
  * @access protected
  */
 function __rotate(&$tmp, $angle, &$color)
 {
     // skip full loops
     //
     if ($angle % 360 == 0) {
         return true;
     }
     // rectangular rotates are OK
     //
     if ($angle % 90 == 0) {
         if (imagick_rotate($tmp->target, $angle)) {
             $tmp->image_width = imagick_getWidth($tmp->target);
             $tmp->image_height = imagick_getHeight($tmp->target);
             return true;
         }
     }
     return false;
 }
开发者ID:ashanrupasinghe,项目名称:slbcv1,代码行数:27,代码来源:class.driver.imagick_ext.php

示例6: image_rotation

function image_rotation($im, $angle, $crop = false)
{
    $fonction = array('image_rotation', func_get_args());
    $image = _image_valeurs_trans($im, "rot-{$angle}-{$crop}", "png", $fonction);
    if (!$image) {
        return "";
    }
    $im = $image["fichier"];
    $dest = $image["fichier_dest"];
    $creer = $image["creer"];
    if ($creer) {
        $effectuer_gd = true;
        if (method_exists('Imagick', 'rotateImage')) {
            $imagick = new Imagick();
            $imagick->readImage($im);
            $imagick->rotateImage(new ImagickPixel('none'), $angle);
            $imagick->writeImage($dest);
            $effectuer_gd = false;
        } else {
            if ($GLOBALS['meta']['image_process'] == "convert") {
                if (_CONVERT_COMMAND != '') {
                    @define('_CONVERT_COMMAND', 'convert');
                    @define('_ROTATE_COMMAND', _CONVERT_COMMAND . ' -background none -rotate %t %src %dest');
                } else {
                    @define('_ROTATE_COMMAND', '');
                }
                if (_ROTATE_COMMAND !== '') {
                    $commande = str_replace(array('%t', '%src', '%dest'), array($angle, escapeshellcmd($im), escapeshellcmd($dest)), _ROTATE_COMMAND);
                    spip_log($commande);
                    exec($commande);
                    if (file_exists($dest)) {
                        $effectuer_gd = false;
                    }
                }
            } elseif (function_exists('imagick_rotate')) {
                $handle = imagick_readimage($im);
                if ($handle && imagick_isopaqueimage($handle)) {
                    imagick_setfillcolor($handle, 'transparent');
                    imagick_rotate($handle, $angle);
                    imagick_writeimage($handle, $dest);
                    $effectuer_gd = false;
                }
            }
        }
        if ($effectuer_gd) {
            // Creation de l'image en deux temps
            // de facon a conserver les GIF transparents
            $im = $image["fonction_imagecreatefrom"]($im);
            imagepalettetotruecolor($im);
            $im = image_RotateBicubic($im, $angle, true);
            _image_gd_output($im, $image);
            imagedestroy($im);
        }
    }
    list($src_y, $src_x) = taille_image($dest);
    return _image_ecrire_tag($image, array('src' => $dest, 'width' => $src_x, 'height' => $src_y));
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:57,代码来源:images_transforme.php

示例7: landscape

 public function landscape()
 {
     if (!HAS_IMAGICK) {
         throw new Exception('Landscape graphs need IMagick installed');
     }
     $filename = $this->makeFileName(true);
     $source = imagick_readimage($filename);
     $rotate = imagick_rotate($source, 270);
     imagick_writeimage($source, $filename);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:10,代码来源:EGSChart.php

示例8: rotate

 function rotate($angle)
 {
     imagick_rotate(&$this->data, -$angle);
     return true;
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:5,代码来源:imagick_old.php

示例9: MooAutoLoad

            break;
    }
    if ($count == 3) {
        $files = MooAutoLoad("MooFiles");
        $files->fileDelete('../' . $file[0] . '.' . $file[1] % 4 . '.' . $file[2]);
        echo $file[1];
    } else {
        echo 0;
    }
}
/***************************************控制层(V)***********************************/
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// 过去的时间
//判断是否登录
adminUserInfo();
if (empty($GLOBALS['adminid'])) {
    echo 'nologin';
    exit;
}
$n = MooGetGPC('n', 'string');
switch ($n) {
    //note 检查会员ID
    case 'resize_and_crop':
        resize_and_crop();
        break;
    case 'imagick_rotate':
        imagick_rotate();
        break;
}
开发者ID:noikiy,项目名称:zays,代码行数:31,代码来源:check_ajax.php

示例10: action_tourner_post

function action_tourner_post($r)
{
	$arg = $r[1];
	$row = sql_fetsel("fichier", "spip_documents", "id_document=$arg");

	if (!$row) return;

	include_spip('inc/charsets');	# pour le nom de fichier
	include_spip('inc/documents');
	// Fichier destination : on essaie toujours de repartir de l'original
	$var_rot = $r[2];
	include_spip('inc/distant'); # pour copie_locale
	$src = _DIR_RACINE . copie_locale(get_spip_doc($row['fichier']));
	if (preg_match(',^(.*)-r(90|180|270)\.([^.]+)$,', $src, $match)) {
		$effacer = $src;
		$src = $match[1].'.'.$match[3];
		$var_rot += intval($match[2]);
	}
	$var_rot = ((360 + $var_rot) % 360); // 0, 90, 180 ou 270

	if ($var_rot > 0) {
		$dest = preg_replace(',\.[^.]+$,', '-r'.$var_rot.'$0', $src);
		spip_log("rotation $var_rot $src : $dest");

		$process = $GLOBALS['meta']['image_process'];

		// imagick (php4-imagemagick)
		if ($process == 'imagick') {
			$handle = imagick_readimage($src);
			imagick_rotate($handle, $var_rot);
			imagick_write($handle, $dest);
			if (!@file_exists($dest)) return;	// echec imagick
		}
		else if ($process == "gd2") { // theoriquement compatible gd1, mais trop forte degradation d'image
			gdRotate ($src, $dest, $var_rot);
		}
		else if ($process == "convert") {
			if (_CONVERT_COMMAND!='') {
				define ('_CONVERT_COMMAND', 'convert');
				define ('_ROTATE_COMMAND', _CONVERT_COMMAND.' -rotate %t %src %dest');
			} else
				define ('_ROTATE_COMMAND', '');
			if (_ROTATE_COMMAND!=='') {
				$commande = str_replace(
					array('%t', '%src', '%dest'),
					array(
						$var_rot,
						escapeshellcmd($src),
						escapeshellcmd($dest)
					),
					_ROTATE_COMMAND);
				spip_log($commande);
				exec($commande);
			} else
				$dest = $src;
		}
	}
	else
		$dest = $src;

	$size_image = @getimagesize($dest);
	$largeur = $size_image[0];
	$hauteur = $size_image[1];

	// succes !
	if ($largeur>0 AND $hauteur>0) {
		sql_updateq('spip_documents', array('fichier' => set_spip_doc($dest), 'largeur'=>$largeur, 'hauteur'=>$hauteur), "id_document=$arg");
		if ($effacer) {
			spip_log("j'efface $effacer");
			spip_unlink($effacer);
		}
		// pipeline pour les plugins
		pipeline('post_edition',
			array(
				'args' => array(
					'table' => 'spip_documents',
					'table_objet' => 'documents',
					'spip_table_objet' => 'spip_documents',
					'type' =>'document',
					'id_objet' => $arg,
					'champs' => array('rotation'=>$r[2],'orientation'=>$var_rot,'fichier'=>$row),
					'serveur' => $serveur,
					'action'=>'tourner',
				),
				'data' => array('fichier'=>$row)
			)
		);
	}

}
开发者ID:rhertzog,项目名称:lcs,代码行数:90,代码来源:tourner.php

示例11: liberty_imagick0_rotate_image

function liberty_imagick0_rotate_image(&$pFileHash)
{
    $ret = FALSE;
    if (!empty($pFileHash['source_file']) && is_file($pFileHash['source_file'])) {
        $iImg = imagick_readimage($pFileHash['source_file']);
        if (!$iImg) {
            $pFileHash['error'] = $pFileHash['name'] . ' ' . tra("is not a known image file");
        } elseif (imagick_iserror($iImg)) {
            $pFileHash['error'] = imagick_failedreason($iImg) . imagick_faileddescription($iImg);
        } elseif (empty($pFileHash['degrees']) || !is_numeric($pFileHash['degrees'])) {
            $pFileHash['error'] = tra('Invalid rotation amount');
        } else {
            if (!imagick_rotate($iImg, $pFileHash['degrees'])) {
                $pFileHash['error'] .= imagick_failedreason($iImg) . imagick_faileddescription($iImg);
            }
            if (!imagick_writeimage($iImg, $pFileHash['source_file'])) {
                $pFileHash['error'] .= imagick_failedreason($iImg) . imagick_faileddescription($iImg);
            }
        }
    } else {
        $pFileHash['error'] = "No source file to resize";
    }
    return empty($pFileHash['error']);
}
开发者ID:kailIII,项目名称:liberty,代码行数:24,代码来源:processor.imagick.php


注:本文中的imagick_rotate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。