Saturday, September 28, 2024
Google search engine
HomeLanguagesPHP | Imagick getImageLength() Function

PHP | Imagick getImageLength() Function

The Imagick::getImageLength() function is an inbuilt function in PHP which is used to get the length of an image object in bytes.

Syntax:

bool Imagick::getImageLength( void)

Parameters: This function does not accept any parameter.

Return Value: This function returns the image length in bytes.

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

Program 1:
Original Image:
https://geeksforgeeks.org/wp-content/uploads/2023/10/neveropen-21-26.png




<?php
  
$imagick = new Imagick(
  
// Getting Length of image
// using getimagerelength function
$res = $imagick->getImageLength();
  
// Display Result 
echo "Length of Image = " . $res;
?>


Output:

Length of Image = 45435 

Program 2:
Original Image:
https://geeksforgeeks.org/wp-content/uploads/2023/10/Screenshot-from-2018-10-16-23-23-54-20.png




<?php
  
$imagick = new Imagick(
  
// Getting Length of image
// using getimagerelength function
$res = $imagick->getImageLength();
  
// Display Result 
echo "Length of Image = ". $res;
?>


Output:

Length of Image = 25694 

Reference: http://php.net/manual/en/imagick.getimagelength.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments