PHP EXIF Manipulation

I am working on an image upload website, trying to ensure it works from mobile device as well.However i have recently been looking at all of the Metadata being stored in the photos and am not a fan of GPS locations going along with simple photos.


I decided to create a new photo using:

HTML:

<form id="frmImageUpload" action="uploadim.php" method="post" enctype="multipart/form-data">

<label for="fileToUpload">File::</label><br>
<input type="file" name="fileToUpload" id="fileToUpload"><br>
<input type="submit" value="submit" name="submit" onclick=" return Validatedata(**THIS RETURNS TRUE AND SUBMITS FORM**)">

uploadim.php PHP:

<?php
$imageObject = imagecreatefromjpeg($_FILES["fileToUpload"]["tmp_name"]);
imagejpeg($imageObject, $target_file, 75);
?>

All works well up to this point and an image is created. However there is no more EXIF data. GPS info is gone, great. Orientation value is gone. No good.

I then found this page on how to manipulate EXIF data:

http://php.net/manual/en/function.iptcembed.php

I integrated this and began to examine how it all worked.

<?php
$imageObject = imagecreatefromjpeg($_FILES["fileToUpload"]["tmp_name"]);
imagejpeg($imageObject, $target_file, 75);

 // iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value)
{
    $length = strlen($value);
    $retval = chr(0x1C) . chr($rec) . chr($data);

    if($length < 0x8000)
    {
        $retval .= chr($length >> 8) .  chr($length & 0xFF);
    }
    else
    {
        $retval .= chr(0x80) . 
                   chr(0x04) . 
                   chr(($length >> 24) & 0xFF) . 
                   chr(($length >> 16) & 0xFF) . 
                   chr(($length >> 8) & 0xFF) . 
                   chr($length & 0xFF);
    }

    return $retval . $value;
}

// Path to jpeg file
$path = $target_file;

// Set the IPTC tags
$iptc = array(
    '2#120' => 'Test image',
    '2#116' => 'Copyright 2008-2009, The PHP Group',
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string)
{
    $tag = substr($tag, 2);
    $data .= iptc_make_tag(2, $tag, $string);
}

// Embed the IPTC data
$content = iptcembed($data, $path);

// Write the new image data out to the file.
$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);

This works fine and i am able to change the copyright data of the image after saving it to its specified folder. My question to you all is how might i go about changing the Orientation of my image? My image is originally in portrait mode . However when i upload it to the server it saves into landscape? I have tried replacing:

$iptc = array(
'2#120' => 'Test image',
'2#116' => 'Copyright 2008-2009, The PHP Group',
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string)
{
    $tag = substr($tag, 2);
    $data .= iptc_make_tag(2, $tag, $string);
}

With:

$iptc = array(
'2#131' => 'P'
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string)
{
    $tag = substr($tag, 2);
    $data .= iptc_make_tag(2, $tag, $string);
}

OR

$iptc = array(
'2#131' => '6'
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string)
{
    $tag = substr($tag, 2);
    $data .= iptc_make_tag(2, $tag, $string);
}

In accordance with information i read about EXIF data Here:
https://sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html

and

http://www.vcode.no/web/resource.nsf/ii2lnug/643.htm

I am familiar with Imagick and all the other libraries i can download. I am just trying to figure out if there is a simple step to completing this with the base PHP that im using and GD. Since i am 95% complete my task minus the image rotation.