imageresolution

FunctionReturn type changed in PHP 8.5

Get or set the resolution of the image.

PHP 5
PHP 7.0-7.1
PHP 7.2
Added
PHP 7.3-7.4
PHP 8.0
Improved
PHP 8.1-8.2
PHP 8.3
PHP 8.4
PHP 8.5
Improved
PHP 8.6

imageresolution Function synopsis

imageresolution(
    GdImage $image,
    ?int $resolution_x = null,
    ?int $resolution_y = null
  ): array|true

Parameters

$image

TypeGdImage

$resolution_x

OptionalType?intDefault valuenull

The horizontal resolution in DPI.

$resolution_y

OptionalType?intDefault valuenull

The vertical resolution in DPI.

Return value

Typearray|true

When used as getter, it returns an indexed array of the horizontal and vertical resolution on success, or false on failure. When used as setter, it returns true on success, or false on failure.

Changes to the imageresolution Function

PHP 8.5

  • Return type changed: array|bool to array|true
  imageresolution(
      GdImage $image,
      ?int $resolution_x = null,
      ?int $resolution_y = null
-   ): array|bool
+   ): array|true

PHP 8.0

  • Return type added: array|bool
  • Parameter name of parameter #1 changed: $im to $image
  • Parameter type added for parameter #1 ($image): GdImage
  • Parameter name of parameter #2 changed: $res_x to $resolution_x
  • Parameter type added for parameter #2 ($resolution_x): ?int
  • Parameter default value added for position #2 ($resolution_x): null
  • Parameter name of parameter #3 changed: $res_y to $resolution_y
  • Parameter type added for parameter #3 ($resolution_y): ?int
  • Parameter default value added for position #3 ($resolution_y): null
  imageresolution(
-     $im,
+     GdImage $image,
-     $res_x,
+     ?int $resolution_x = null,
-     $res_y
+     ?int $resolution_y = null
-   )
+   ): array|bool

PHP 7.2

  • Function added

imageresolution Function Availability

PHP VersionAvailability
PHP 8.6Future Release Yes
PHP 8.5Upcoming Release Yes
PHP 8.4Supported (Latest) Yes
PHP 8.3Supported Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Security-Fixes Only Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported No
PHP 7.0Unsupported No
PHP 5.6Unsupported No
PHP 5.5Unsupported No
PHP 5.4Unsupported No
PHP 5.3Unsupported No