php8.5
Home/ Manual/ image / functions/ imagesx

imagesx

PHP function Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Get image width

Description

imagesx(GdImage $image): int

Returns the width of the given image object.

Parameters

Return Values

Return the width of the image.

Changelog

VersionDescription

Examples

Using imagesx()

php
<?php

// create a 300*200 image
$img = imagecreatetruecolor(300, 200);

echo imagesx($img); // 300

?>

See Also

Source: reference/image/functions/imagesx.xml · from the official PHP manual (php/doc-en)