title: Embedding IPTC image data with PHP GD
body: <p>I'm trying to embed a IPTC data onto a JPEG image using <code>iptcembed()</code> but am having a bit of trouble.</p>
  
  <p>I have verified it is in the end product:</p>
  
  <pre><code>// Embed the IPTC data
  $content = iptcembed($data, $path);
  
  // Verify IPTC data is in the end image
  $iptc = iptcparse($content);
  var_dump($iptc);
  </code></pre>
  
  <p>Which returns the tags entered.</p>
  
  <p>However when I save and reload the image the tags are non existant:</p>
  
  <pre><code>// Save the edited image
  $im = imagecreatefromstring($content);
  imagejpeg($im, 'phplogo-edited.jpg');
  imagedestroy($im);
  
  // Get data from the saved image
  $image = getimagesize('./phplogo-edited.jpg');
  
  // If APP13/IPTC data exists output it
  if(isset($image['APP13']))
  {
      $iptc = iptcparse($image['APP13']);
      print_r($iptc);
  }
  else
  {
      // Otherwise tell us what the image *does* contain
      // SO: This is what's happening
      print_r($image);
  }
  </code></pre>
  
  <p>So why aren't the tags in the saved image?</p>
  
  <p>The PHP source is <a href="http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php?source" rel="nofollow noreferrer">avaliable here</a>, and the respective outputs are:</p>
  
  <ol>
  <li><a href="http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php?return_image" rel="nofollow noreferrer">Image output</a></li>
  <li><a href="http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php" rel="nofollow noreferrer">Data output</a></li>
  </ol>