tag width or height; here we are creating a new image
header("Content-type:image/jpeg");
$image = imagecreatefromjpeg("img/girl_lookaway.jpg");
$width = imagesx($image);
$height = imagesy($image);
$ratio = $width/$height;
$new_width = 300;
$new_height = $new_width / $ratio;
$image_resized = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_resized);
?>