php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57795 Imagick GRAVITY_CONST
Submitted: 2007-08-23 14:15 UTC Modified: 2007-08-23 14:25 UTC
From: alan at ridersite dot org Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5.2.1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alan at ridersite dot org
New email:
PHP Version: OS:

 

 [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.  




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-23 14:25 UTC] mkoppanen@php.net
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;
?>
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 05:01:28 2025 UTC