title: How to truncate filename from end with limit
body: <p>Let's say we have three file names:</p>
  
  <pre><code>var a = "01704_0047a_05a_canvas.jpg";
  var b = "101704_0047a_05a_canvas.jpg";
  var c = "foo.jpg";
  </code></pre>
  
  <p>Obviously the three are 1 character different, this is just to illustrate that the filenames will vary in length, what I'm aiming to do, is only display the last 10 characters from the end, regardless of the length of the filename, Results:</p>
  
  <pre><code>var a = "canvas.jpg";
  var b = "canvas.jpg";
  var c = "foo.jpg";
  </code></pre>
  
  <p>here's what I've tried:</p>
  
  <pre><code>a.substring(a.length, 10);
  </code></pre>
  
  <p>This seems to give me different results thought, ideas?</p>
  
  <p>I also need to mimic the same result in php if someone feels generous!</p>