title: Add metadata to PNG image using PHP
body: <p>Is there a way to add metadata (such as keywords) to several png images using php? I have stored the images in my database, and I want to do the same with their corresponding keywords, but I haven't found any helpful suggestions using php yet. Thanks </p>
  
  <p>image.php</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
   &lt;title&gt;Upload Images&lt;/title&gt;
  &lt;/head&gt;
   &lt;body&gt;
   &lt;form action="tags.php" method="POST" enctype="multipart/form-data" &gt;
    &lt;p&gt;Select Image (one or multiple):&lt;/p&gt;
    &lt;input type="hidden" name="MAX_FILE_SIZE" value="536870912"/&gt;
    &lt;input type="file" name="image[]" accept="image/png" accept="image/jpg" accept="image/jpeg" accept="image/gif" multiple="multiple" /&gt;
    &lt;input type="submit" value="Upload file" name="submit" /&gt;
  
   &lt;/form&gt;
   &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>tags.php (Raptor's answer)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  include('../config.php');
  
  $image = new Imagick();
  $image-&gt;readImage("C:/xampp/htdocs/cmanager/uploads");
  $image-&gt;setImageProperty('keywords', 'Imagick');
  
  print($image-&gt;getImageProperty('keywords'));</code></pre>
  </div>
  </div>
  </p>