Copy an image read from file with the imagecopymerge() Function in PHP

Description

The following code shows how to copy an image read from file with the imagecopymerge() Function.

Example


<?php/*from  ww w . j a v  a2 s  .c o m*/
    define("SRC_FILE", "test.png");

    $img = imagecreatefrompng(SRC_FILE);
    $img_copy = imagecreatefrompng(SRC_FILE);

    imagecopymerge($img_copy, $img, 10, 10, 0,
                   0, imagesx($img), imagesy($img), 50);

    header("Content-Type: image/png");
    imagepng($img_copy);
?>

The code above generates the following result.

Copy an image read from file with the imagecopymerge() Function in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text