title: get media by title - wordpress
body: <p>I'm making a custom page template in wordpress and adding an image by using a custom field. Like this:</p>
  
  <pre><code>    &lt;img src="&lt;?php echo bloginfo('url') ?&gt;&lt;?php echo get_post_meta($post-&gt;ID, 'main_picture', true); ?&gt;" /&gt;
  </code></pre>
  
  <p>I'm putting the path to the image in a custom field. </p>
  
  <p>The image is uploaded through the custom panel so the custom files will have a Name of 'main_picture' and a value of the upload path, like so - 'wordpress/wp-content/uploads/2012/01/mypic.png'</p>
  
  <p>I'd prefer to be able to reference the image by title, and extrapolate the image url from that title. </p>
  
  <p>Is that possible?</p>
  
  <p>Let me know if my question doesn't make sense. I'm quite new to wordpress. 
  ----------------------edit----------</p>
  
  <p>I realise that using the image name is not a great idea, as it won't always be unique. I;m trying to make it as easy on the client as possible. They're going to be wary of using custom fields, image names will be the easiest thing for them to understand. </p>