title: Crop image to correct size by tweaking the image url
body: <p>I am trying to crop Lazyload image to correct size. So i have simple jquery plugin given below that can resize and crop the image to correct size by tweaking the image url. This jQuery code automatically crop the image to the correct size. But when i use Lazyload plugin for load image the script not able to crop image.</p>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>var w = 200;
  var h = 150;
  $('#crop').find('img').each(function(n, image){
    var image = $(image);
    image.attr({src : image.attr('src').replace(/s\B\d{2,4}/,'s' + w + '-h' + h +'-c')});
    image.attr('width',w);
    image.attr('height',h);
   });
  </code></pre>
  
  <p><strong>HTML:</strong> Fiddle: <a href="http://jsfiddle.net/kh5btqyu/3/" rel="nofollow">http://jsfiddle.net/kh5btqyu/3/</a> (with out Lazyload)</p>
  
  <pre><code>&lt;div id="crop"&gt;
  &lt;img src=""/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Lazyload HTML:</strong> Fiddle: <a href="http://jsfiddle.net/v2fud3a4/4/" rel="nofollow">http://jsfiddle.net/v2fud3a4/4/</a>  (unable to crop)</p>
  
  <pre><code>&lt;div id="crop"&gt;
  &lt;img data-src=""/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Actually Lazyload plugin works when we change image <em>src</em> <code>&lt;img src=""/&gt;</code> to <em>data-src</em> <code>&lt;img data-src=""/&gt;</code> and when we scroll down page, when image get window viewport then it replace image link <code>&lt;img data-src=""/&gt;</code> to <code>&lt;img data-src="" src=""/&gt;</code> then images will visible.</p>
  
  <p>So my image crop plugin not able to find image <code>scr</code> link. Because for Lazyload plugin we have <code>&lt;img data-src="" src=""/&gt;</code> link. Another reason is my image crop plugin run after page load, but Lazyload make loads image on window viewport, when we scroll down page and image get window view.</p>
  
  <p>My question is there are any way to run my image crop plugin, when lazyload plugin replace image link <code>&lt;img data-src=""/&gt;</code> to <code>&lt;img data-src="" src=""/&gt;</code>, means my crop plugin run when Lazyload plugin has loaded image.</p>
  
  <p>Thanks.</p>