Monday, October 6, 2025
HomeLanguagesPHP | Imagick getImageOrientation() Function

PHP | Imagick getImageOrientation() Function

The Imagick::getImageOrientation() function is an inbuilt function in PHP which is used to get the image orientation.

Syntax:

int Imagick::getImageOrientation( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns an integer value containing one of ORIENTATION constants.

List of ORIENTATION constants are given below:

  • imagick::ORIENTATION_UNDEFINED (0)
  • imagick::ORIENTATION_TOPLEFT (1)
  • imagick::ORIENTATION_TOPRIGHT (2)
  • imagick::ORIENTATION_BOTTOMRIGHT (3)
  • imagick::ORIENTATION_BOTTOMLEFT (4)
  • imagick::ORIENTATION_LEFTTOP (5)
  • imagick::ORIENTATION_RIGHTTOP (6)
  • imagick::ORIENTATION_RIGHTBOTTOM (7)
  • imagick::ORIENTATION_LEFTBOTTOM (8)

Exceptions: This function throws ImagickException on error.

Below programs illustrate the Imagick::getImageOrientation() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Get the Orientation
$orientation = $imagick->getImageOrientation();
echo $orientation;
?>


Output:

 0 // Which corresponds to imagick::ORIENTATION_UNDEFINED.

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Set the Orientation
$imagick->setImageOrientation(imagick::ORIENTATION_TOPRIGHT);
  
// Get the Orientation
$orientation = $imagick->getImageOrientation();
echo $orientation;
?>


Output:

2

Reference: https://www.php.net/manual/en/imagick.getimageorientation.php

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32337 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6707 POSTS0 COMMENTS
Nicole Veronica
11871 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6823 POSTS0 COMMENTS
Ted Musemwa
7089 POSTS0 COMMENTS
Thapelo Manthata
6779 POSTS0 COMMENTS
Umr Jansen
6779 POSTS0 COMMENTS