|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-08-23 14:15 UTC] alan at ridersite dot org
Description: ------------ The IM image -gravity command is very useful. I can't figure out how to use it in Imagick. Imagick has: Gravity constants imagick::GRAVITY_NORTHWEST (integer) etc. The GRAVITY_xxxxs don't seem to have values assigned. But, there does not seem to be an Imagick equivalent to the IM -gravity command. There is a setGravity ( int $gravity ) command; but, it doesn't recognize the Imagick class constants, if there are any. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 16:00:01 2025 UTC |
Thank you for taking the time to write to us, but this is not a bug. This functionality is tested and working. I am marking this bug as bogus. Here is an example code how to use GRAVITY constants: <?php /* Create Imagick object */ $Imagick = new Imagick( 'image.jpg' ); /* Create a drawing object and set the font size */ $ImagickDraw = new ImagickDraw(); $ImagickDraw->setFontSize( 30 ); $ImagickDraw->setFillAlpha( 0.4 ); /* Set gravity to the center */ $ImagickDraw->setGravity( Imagick::GRAVITY_CENTER ); /* Write the text on the image */ $Imagick->annotateImage( $ImagickDraw, 4, 20, 0, "Test spaces" ); /* Output */ header( "Content-Type: image/{$Imagick->getImageFormat()}" ); echo $Imagick; ?>