Speed up development with full-stack environments for every branch.

Learn More

Create image using GD [PHP]

Forked from Hello World.

14 Runs 22 Views 4 Copies

Basic PHP Hello World Example

Saved

Saved

<?php

header('Content-Type: image/jpeg');

$im_orig=imagecreatefromjpeg("https://drupal-multisite-s3.s3-us-west-2.amazonaws.com/files/universo.1.jpg");
$im_dest=imagecreatefromjpeg("https://www.jpl.nasa.gov/spaceimages/images/wallpaper/PIA09579-800x600.jpg");
$im_dest_x=110;
$im_dest_y=60;
$im_orig_x=0;
$im_orig_y=0;
$im_orig_w=240;
$im_orig_h=180;
$im_orig_nw=100;
$im_orig_nh=75;

imagecopyresampled($im_dest, $im_orig, $im_dest_x, $im_dest_y, $im_orig_x, $im_orig_y, $im_orig_w, $im_orig_h, $im_orig_nw, $im_orig_nh);

imagejpeg($im_dest);
imagedestroy($im_dest);
imagedestroy($im_orig);

?>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).