hey sub heres a modified version of that resizer in cludes transparent backgrounds and url image resizing
<?
if ($_GET['src'])
{
$src = $_GET['src'];
$type = $_GET['type'];
$ext = strtolower(substr($src,-3));
//$ext = substr($src,strrpos($src,'.')+1);
$file_types = array("jpg" => "image/jpeg", "gif" => "image/gif", "png" => "image/png");
if (!in_array("image/$ext",$file_types))die("cannot determine image type");
///// CONTENT TYPE /////
if (isset($type)) header("Content-type: $file_types[$type]");
else if (in_array("image/$ext",$file_types)) header("Content-type: $file_types[$ext]");
///// CREATE IMAGE /////
if ($type == "jpg" || $ext == "jpg") $im = imagecreatefromjpeg($src);
else if ($type == "gif" || $ext == "gif") $im = imagecreatefromgif($src);
else if ($type == "png" || $ext == "png") $im = imagecreatefrompng($src);
///// DOWNLOAD URL IMAGE /////
$temp = false;
if (substr($src,0,7) == "http://")
{
$tmpfname = tempnam("tmp/","TmP.$ext");
$temp = @fopen($tmpfname,"w");
if ($temp)
{
@fwrite($temp,@file_get_contents($src)) or die("Cannot download image");
@fclose($temp);
$src = $tmpfname;
}
else die("Cannot create temp file");
}
///// SIZE PERCENTAGE /////
if ($_GET['p'])
{
$x = round((imagesx($im)*$_GET['p'])/100);
$y = round((imagesy($im)*$_GET['p'])/100);
$yyy = 0;
$xxx = 0;
$imw = imagecreatetruecolor($x,$y);
}
///// WIDTH AND HEIGHT /////
else if ($_GET['w'] && $_GET['h'])
{
$x = $_GET['w'];
$y = $_GET['h'];
$yyy = 0;
$xxx = 0;
$imw = imagecreatetruecolor($x,$y);
}
///// MAX HEIGHT/WIDTH /////
else if ($_GET['s'])
{
if (imagesy($im) >= $_GET['s'] || imagesx($im) >= $_GET['s'])
{
if (imagesy($im) >= imagesx($im))
{
$y = $_GET['s'];
$x = ($y*imagesx($im))/imagesy($im);
}
else
{
$x = $_GET['s'];
$y = ($x*imagesy($im))/imagesx($im);
}
}
else
{
$x = imagesx($im);
$y = imagesy($im);
}
$yyy = 0;
$xxx = 0;
$imw = imagecreatetruecolor($x,$y);
}
///// SQUARE IMAGE /////
else if ($_GET['sq'])
{
if (imagesy($im) >= $_GET['sq'] || imagesx($im) >= $_GET['sq'])
{
if (imagesy($im) >= imagesx($im))
{
$x = $_GET['sq'];
$y = ($x*imagesy($im))/imagesx($im);
$yyy = -($y-$x)/2;
$xxx = 0;
}
else
{
$y = $_GET['sq'];
$x = ($y*imagesx($im))/imagesy($im);
$xxx = -($x-$y)/2;
$yyy = 0;
}
}
else
{
$x = imagesx($im);
$y = imagesy($im);
$yyy = 0;
$xxx = 0;
}
$imw = imagecreatetruecolor($_GET['sq'],$_GET['sq']);
}
else
{
$x = imagesx($im);
$y = imagesy($im);
$yyy = 0;
$xxx = 0;
$imw = imagecreatetruecolor($x,$y);
}
imageAntiAlias($imw,true);
imagealphablending($imw, false);
imagesavealpha($imw,true);
$transparent = imagecolorallocatealpha($imw, 255, 255, 255, 127);
imagefilledrectangle($imw, 0, 0, $t_wd, $t_ht, $transparent);
imagecopyresampled($imw, $im, $xxx,$yyy,0,0,$x,$y,imagesx($im), imagesy($im));
///// WATERMARK /////
if ($_GET['txt'])
{
if ($_GET['c']) $watermark_color = $_GET['c'];
else $watermark_color = "000000";
$red = hexdec(substr($watermark_color,0,2));
$green = hexdec(substr($watermark_color,2,2));
$blue = hexdec(substr($watermark_color,4,2));
$text_col = imagecolorallocate($imw,$red,$green,$blue);
$font = "georgia.ttf";
$font_size = 12;
$angle = 0;
$box = imagettfbbox($font_size, $angle, $font, $_GET['txt']);
$x = 5;
$y = ImageSY($imw);
imagettftext($imw, $font_size, $angle, $x, $y, $text_col, $font, $_GET['txt']);
}
if ($_GET['type'] == "jpg") imagejpeg($imw);
else if ($_GET['type'] == "gif") imagegif($imw);
else if ($_GET['type'] == "png") imagepng($imw);
else
{
if ($type == "jpg" || $ext == "jpg") imagejpeg($imw);
else if ($type == "gif" || $ext == "gif") imagegif($imw);
else if ($type == "png" || $ext == "png") imagepng($imw);
}
imagedestroy($imw);
if (!empty($tmpfname)) unlink($tmpfname);
}
?>