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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC