Leaflet: adjust popup to picture size
<p>I'm trying to include pictures in my leaflet popups, but the popup-size doesn't adjust to the picture size. I found a solution to this on github:</p>

<p><a href="https://github.com/Leaflet/Leaflet/issues/724" rel="noreferrer">https://github.com/Leaflet/Leaflet/issues/724</a></p>

<p>While that solution fixes the size of the popup, the result is shifted and the popup doesn't show up centered over the icon/marker... Any way to change that?</p>

<pre><code>.leaflet-popup-content { 
     width:auto !important; 
}
</code></pre>

<p><img src="https://cloud.githubusercontent.com/assets/8722284/16545362/3c56845a-4129-11e6-9dfd-c8c1912c9f47.png" alt="screenshot from 2016-07-03 14 19 25"></p>

<p>Also the other proposed solution (setting the maxWidth on the popup) doesn't help in my case. The popup width keeps on being the default width of 300px...</p>

<pre><code>function pop_Fotos(feature, layer) {
     var popupContent = '&lt;img style="max-height:500px;max-width:500px;" src="...");
     layer.bindPopup(popupContent, {maxWidth: 500, closeOnClick: true});
}
</code></pre>

<p><img src="https://cloud.githubusercontent.com/assets/8722284/16545506/5e2a04ea-412d-11e6-8f63-f0ef3541004d.png" alt="screenshot from 2016-07-03 14 49 15"></p>