imagecopymerge

FunctionReturn type changed in PHP 8.5

Copy and merge part of an image.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1-8.2
PHP 8.3
PHP 8.4
PHP 8.5
Improved
PHP 8.6

imagecopymerge Function synopsis

imagecopymerge(
    GdImage $dst_image,
    GdImage $src_image,
    int $dst_x,
    int $dst_y,
    int $src_x,
    int $src_y,
    int $src_width,
    int $src_height,
    int $pct
  ): true

Parameters

$dst_image

TypeGdImage

Destination image resource.

$src_image

TypeGdImage

Source image resource.

$dst_x

Typeint

x-coordinate of destination point.

$dst_y

Typeint

y-coordinate of destination point.

$src_x

Typeint

x-coordinate of source point.

$src_y

Typeint

y-coordinate of source point.

$src_width

Typeint

Source width.

$src_height

Typeint

Source height.

$pct

Typeint

The two images will be merged according to $pct which can range from 0 to 100. When $pct = 0, no action is taken, when 100 this function behaves identically to imagecopy for pallete images, except for ignoring alpha components, while it implements alpha transparency for true colour images.

Return value

Typetrue

Returns true on success, false on failure

Changes to the imagecopymerge Function

PHP 8.5

  • Return type changed: bool to true
  imagecopymerge(
      GdImage $dst_image,
      GdImage $src_image,
      int $dst_x,
      int $dst_y,
      int $src_x,
      int $src_y,
      int $src_width,
      int $src_height,
      int $pct
-   ): bool
+   ): true

PHP 8.0

  • Return type added: bool
  • Parameter name of parameter #1 changed: $dst_im to $dst_image
  • Parameter type added for parameter #1 ($dst_image): GdImage
  • Parameter name of parameter #2 changed: $src_im to $src_image
  • Parameter type added for parameter #2 ($src_image): GdImage
  • Parameter type added for parameter #3 ($dst_x): int
  • Parameter type added for parameter #4 ($dst_y): int
  • Parameter type added for parameter #5 ($src_x): int
  • Parameter type added for parameter #6 ($src_y): int
  • Parameter name of parameter #7 changed: $src_w to $src_width
  • Parameter type added for parameter #7 ($src_width): int
  • Parameter name of parameter #8 changed: $src_h to $src_height
  • Parameter type added for parameter #8 ($src_height): int
  • Parameter type added for parameter #9 ($pct): int
  imagecopymerge(
-     $dst_im,
+     GdImage $dst_image,
-     $src_im,
+     GdImage $src_image,
-     $dst_x,
+     int $dst_x,
-     $dst_y,
+     int $dst_y,
-     $src_x,
+     int $src_x,
-     $src_y,
+     int $src_y,
-     $src_w,
+     int $src_width,
-     $src_h,
+     int $src_height,
-     $pct
+     int $pct
-   )
+   ): bool

PHP 7.4

  • Parameter name of parameter #1 changed: $src_im to $dst_im
  • Parameter name of parameter #2 changed: $dst_im to $src_im
  imagecopymerge(
-     $src_im,
+     $dst_im,
-     $dst_im,
+     $src_im,
      $dst_x,
      $dst_y,
      $src_x,
      $src_y,
      $src_w,
      $src_h,
      $pct
    )

imagecopymerge 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 Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes