title: How can I add a drop-shadow to an image using PHP?
body: <p>I am looking for a way to add a drop shadow to an image using PHP. Before you answer or vote to close: I am <em>not</em> looking to do this using CSS or HTML. I want to generate an image file. This is <em>not</em> a duplicate of <a href="https://stackoverflow.com/questions/3379603/php-imagemagic-get-the-shadow-of-an-image">this question</a> nor <a href="https://stackoverflow.com/questions/1759416/add-dynamic-no-matter-image-size-shadow-effect-on-images">this one</a>.</p>
  
  <p><strong>I am looking for a very specific effect</strong>. For example, given this input image:</p>
  
  <p><img src="https://i.stack.imgur.com/XHA6n.jpg" alt="It&#39;s an image!" title="It&#39;s an image!"></p>
  
  <p>I want to produce the following image:</p>
  
  <p><img src="https://i.stack.imgur.com/QlExi.png" alt="It&#39;s an image, with a drop shadow!" title="It&#39;s an image, with a drop shadow!"></p>
  
  <hr>
  
  <p>TL;DR: This image above was generated using Photoshop's Drop Shadow effect. I want a look very similar to that. For reference, here's the settings our design team used. Ideally, I'd have similar control in my code for angle, distance, opacity, etc:</p>
  
  <p><img src="https://i.stack.imgur.com/P1NmI.png" alt="It&#39;s some Photoshop settings!" title="It&#39;s an image WITH FREEHAND CIRCLES!!! OMG WTF BBQ!!!!!"></p>
  
  <p>I have full access to our debian-linus-based servers, so any GD or ImageMagick solution will work. As will any FOSS linux software solution, although I'd prefer a way to do it with IM or GD as those are already installed and don't require new software to be installed.</p>
  
  <p><strong>The shadow must be able to be placed on a transparent, non-rectangular PNG!</strong></p>
  
  <p>I'm asking the question mainly because the scripts and solutions I have found on the web either only produce rectangular shadows, look like total poo, or just plain don't work at all.</p>