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
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS