title: PHP ImageMagick get image from http
body: <p>I am trying to use ImageMagick for some photo manipulation (crop for the moment). I succeed previously the desired outcome by using GD library for PHP (on my localhost) but now the hosting doesn't support it and they suggest me to use ImageMagick instead. The issue is that I can crop an image that it is stored locally :</p>
  
  <pre><code>&lt;?php
  $four = '4fingers1.jpg';
  exec("convert $four -crop 100x100+100+100 test.jpg");
  ?&gt;
  &lt;img src="test.jpg"&gt;
  </code></pre>
  
  <p>with no problem but when it comes from http sources (the actual purpose of my script) I receive no image. The code is the following (I post with a form the actual src of the image):</p>
  
  <pre><code>$src = $_POST['src'];
  exec("convert $src -resize 720x720 resized.jpg"); // this is specified in the documentation
  exec("convert resized.jpg -crop 100x100+100+100 final.jpg");
  ?&gt;
  &lt;img src="final.jpg"&gt; &lt;!-- no image --&gt;
  &lt;img src="resized.jpg"&gt; &lt;!-- no image --&gt;
  &lt;img src="&lt;?php echo $src; ?&gt;"&gt; &lt;!-- alright --&gt;
  </code></pre>
  
  <p>The documentation specify the following: </p>
  
  <blockquote>
    <p>IM can also download an image that is published on the 'world wide
    web' by specifying that images URL. This basically provides a 'http:'
    image coder, which is why it works.</p>
  </blockquote>
  
  <p>Link: <a href="http://www.imagemagick.org/Usage/files/#read" rel="nofollow">http://www.imagemagick.org/Usage/files/#read</a></p>
  
  <p>I've tried a lots of code snippets founded online and can't figure it out why is not working? I can use maybe something else to reach my purpose?</p>