cheechm Posted May 5, 2007 Share Posted May 5, 2007 Hi, I am trying to show an image using this script: function CopyImageFileGD($name,$ext,$newwidth,$newheight) { if($ext == "jpg"){ $new_img = imagecreatefromjpeg("images_files/$name"); }elseif($ext == "png"){ $new_img = imagecreatefrompng("images_files/$name"); }elseif($ext == "gif"){ $new_img = imagecreatefromgif("images_files/$name"); } list($width, $height) = getimagesize("images_files/$name"); if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); } imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); ImageJpeg ($resized_img); ImageDestroy ($resized_img); ImageDestroy ($new_img); } $Ext = getFileExtension($_GET[File]); if(!empty($_GET[File]) && !empty($_GET[w]) && !empty($_GET[h])) { include"config.php"; if(!empty($_GET[Large])) { $q1 = "update `images` set `Viewed` = Viewed+1 where `Image` = '$_GET[File]'"; mysql_query($q1) or die(mysql_error()); } header('Content-Type: image/jpeg'); $Image = CopyImageFileGD($_GET[File],$Ext,$_GET[w],$_GET[h]); } An example address is www.mydomain.com/photos/image.php?File=1178320821.jpg&w=150&h=112.5 image.php is in the same directory as images_files. The thing is, that the image doesn't show. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/50125-showing-an-image/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.