Skip to content

Instantly share code, notes, and snippets.

@devyfriend
Created April 16, 2013 06:11
Show Gist options
  • Select an option

  • Save devyfriend/5393742 to your computer and use it in GitHub Desktop.

Select an option

Save devyfriend/5393742 to your computer and use it in GitHub Desktop.
function _merge_photo($original_image)
{
//test(FCPATH.'assets/loop/img/frame.png',1);
# If you don't know the type of image you are using as your originals.
$image = imagecreatefromstring(file_get_contents(FCPATH.'loop_upload/'.$original_image['file_name']));
$frame = imagecreatefrompng(FCPATH.'assets/loop/img/frame.png');
# If you know your originals are of type PNG.
//$image = imagecreatefrompng($original_image);
//$frame = imagecreatefrompng($frame_image);
imagesavealpha($frame, true);
imagealphablending($frame, true);
//imagecopymerge($image, $frame, 0, 0, 0, 0, 758, 512, 100);
imagecopyresampled($image, $frame, 0, 0, 0, 0, 758, 512,758, 512);
# Save the image to a file
$dt = getdate();
imagepng($image, FCPATH.'loop_upload/gallery/'.$dt[0].'.png');
# Output straight to the browser.
//header('Content-Type: image/png');
//imagepng($image);
return $dt[0].'.png';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment