How can I find the width and height of an image resource?

Answer Posted / jude jeevanraj.p

It is often useful to know the width and height of an image
resource. This can be achieved with the functions imagesx
and imagesy, like this:

<?php
$img = imagecreatetruecolor(400, 100);
echo imagesx($img); // 400
echo imagesy($img); // 100
?>

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the best method for sanitizing user input with php?

493


What does mvc stand for and what does each component do?

543


Which is incorrect with respect to separating php code and html?

542


What is var_dump function in php?

542


Where are cookies stored php?

507






How can you retrieve a cookie value?

549


How can we calculate the similarity between two strings?

581


What does $this do in php?

532


Does exist in php?

541


Explain how does one prevent the following warning ‘warning: cannot modify header information – headers already sent' and why does it occur in the first place?

517


Explain php parameterized functions.

563


How to change the principal password?

627


Difference between $message vs. $$Message in php.

589


What are objects in php?

532


What does namespace mean in php?

556