Skip to content

Instantly share code, notes, and snippets.

@drewlesueur
Created November 17, 2010 03:42
Show Gist options
  • Save drewlesueur/702946 to your computer and use it in GitHub Desktop.
Save drewlesueur/702946 to your computer and use it in GitHub Desktop.
Simple image manipulation functions for php
public static function resize_image($image, $w, $h) {
$ret = imagecreatetruecolor($w, $h);
imagealphablending( $ret, false );
imagesavealpha( $ret, true );
imagecopyresampled($ret, $image, 0, 0, 0, 0, $w, $h, imagesx($image), imagesy($image));
//imageantialias($ret,true);
return $ret;
}
public static function overlay_image($image, $overlay, $x, $y) {
imagealphablending($image, true);
imagealphablending($overlay, true);
imagecopy($image, $overlay, $x, $y, 0, 0, imagesx($overlay), imagesy($overlay));
//return $image;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment