I am making a dynamic signature generator and I would like to add a avatar image in part of the signature. How would I do this as well as sizing down the image?
Here is an example.
I have 2 images:
Steps:
<?php
header('Content-Type: image/jpg');
$canvas = imagecreatetruecolor(720, 637);
$icon1 = imagecreatefromjpeg('https://s-media-cache-ak0.pinimg.com/736x/d1/2e/9e/d12e9ecd9f4c4e45dafa5880c7d99c73.jpg');
$icon2 = imagecreatefromjpeg('http://cf.juggle-images.com/matte/white/280x280/php-1-logo-primary.jpg');
//add 2 source images
imagecopy($canvas, $icon1, 0, 0, 0, 0, 720, 637);
imagecopyresized($canvas, $icon2, 0, 0, 0, 0, 100, 100, 280, 280);
//Output image to browser
imagejpeg($canvas);
?>
You can do that by copying one image on the other, with some resampling (to make the avatar smaller, if desired.).
PHP must have GD libs included, if not, make sure you have support for GD, otherwise you cannot use the functions.
Check your GD support: function.gd-info.php
Then start reading here:
or here: function.imagecopyresampled.php