ahah! I see the problem try something like this (from the php.net user submitted data)
<?php
Header("Content-type: image/jpeg");
$filename = "filename.jpg";
$img_size = getImageSize($filename);
$x = $img_size[0];
$y = $img_size[1];
if ($x > $y)
{
$newd = $x;
}
else
{
$newd = $y;
}
$src_img = ImageCreateFromJPEG($filename);
$dst_img = ImageCreateTrueColor($newd,$newd);
$final_img = ImageCreateTrueColor($y,$x);
ImageCopyResampled($dst_img,$src_img,0,0,0,0,$x,$y,$x,$y);
$degrees = "90";
$rotated_img = ImageRotate($dst_img,$degrees,0);
ImageCopyResampled($final_img,$rotated_img,0,0,0,0,$y,$x,$y,$x);
ImageJPEG($final_img);
?>