"; print_r($obj); echo ""; } /* Function nexus_create_thumb($src_image,$des_image,$dw,$dh) creates a resized image variables: $name Original filename $filename Filename of the resized image $new_w width of resized image $new_h height of resized image */ function nexus_create_thumb ($src_image, $des_image, $dw, $dh) { $src_info = getimagesize($src_image); $sw = $src_info[0]; $sh = $src_info[1]; $sx = 0; $sy = 0; if ($sh < 1 || $dh < 1) { $error_info[0] = 0; return FALSE; } if ($sw/$sh > $dw/$dh) { $chop_w = floor($sh*$dw/$dh); $chop_h = $sh; $sx = floor(($sw - $chop_w) / 2 - 1); } else { $chop_w = $sw; $chop_h = floor($sw*$dh/$dw); $sy = floor(($sh - $chop_h) / 2 - 1); } $des_im = imagecreatetruecolor ($dw, $dh); switch ($src_info[2]) { case "1": // gif $src_im = imagecreatefromgif($src_image); break; case "2": // jpg $src_im = ImageCreateFromJPEG($src_image); break; case "3": // png $src_im = ImageCreateFromPNG($src_image); break; default: $error_info[0] = 100; return false; } ImageCopyResized ($des_im, $src_im, 0, 0, $sx, $sy, $dw, $dh, $chop_w, $chop_h); ImagePNG ($des_im, $des_image); chmod ($des_image, 0664); return true; } ?>