# Gd image resize - can't see what im doing wrong?

**URL:** <https://forum.kirupa.com/t/gd-image-resize-cant-see-what-im-doing-wrong/237604>\
**Category:** Uncategorized\
**Created:** [August 31, 2007, 9:03pm UTC](https://forum.kirupa.com/t/gd-image-resize-cant-see-what-im-doing-wrong/237604 "2007-08-31T21:03:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![susancbk](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@susancbk](https://forum.kirupa.com/u/susancbk)\
**Post date:** [August 31, 2007, 9:03pm UTC](https://forum.kirupa.com/t/gd-image-resize-cant-see-what-im-doing-wrong/237604/1 "2007-08-31T21:03:17Z")

</div>

can anyone spot what im doing wrong here?  
I modified this script from another script thats working fine on my server …  
just cant see what’s making this not work…

```auto

<?
	

	$fileType = "jpg";
	
	$file = "test.jpg";

	$finishedThumb = "thumb.".$fileType;
	

	list($width, $height) = getimagesize($file);
	

	$newwidth = 200;
	$newheight = 200;
	
	
	
	// create the thumb image
	$thumb = imagecreatetruecolor($newwidth, $newheight);
	
	
	
	// load source data
	if ($fileType=="gif")
		$source = imagecreatefromgif($file);
	elseif ($fileType=="jpg")
		$source = imagecreatefromjpeg($file);
	elseif ($fileType=="png")
		$source = imagecreatefrompng($file);
		

		
	imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
		
		
		
	// create the thumb
	if ($fileType=="gif")
		imagegif($thumb,$finishedThumb);
	elseif ($fileType=="jpg")
		imagejpeg($thumb,$finishedThumb);
	elseif ($fileType=="png")
		imagepng($thumb,$finishedThumb);

echo $finishedThumb;

?>

```
