PHP Imagesx () function

PHP

Syntax:
int imagesx ($image)
Parameters:This function takes single parameters $image, which are required. This $image variable can store the image generated by the imagecreatetruecolor() function.Return Value:This function returns the width of the image or FALSE on error.The following programs illustrate the imagesx() functionin PHP.Program 1:  
/ / save the image to a variable. $image = imagecreatefrompng ( "gfg.png" );  
// Display the width of the image. echo imagesx ( $image );  
?>
Output:
667
Program 2:  
// Create image or blank image size. $image = imagecreatetruecolor (500, 300);  
// Display the width of the image. echo imagesx ( $image );  
?>
Output:
500
Related Articles:
  • PHP | Imagedashedline() function
  • PHP | imagecolorat() function
  • PHP | Imagepolygon() function
Link: http://php.net/manual/en/function.imagesx.php



Get Solution for free from DataCamp guru