Question: I am moving my wordpress from live to local, to make some changes and then upload it again on a new host. When I finished uploading the XML, some images were missing, and now I am unable to upload THAT images. I can upload any other one, but for some reasons, even if i resize in photoshop, change the filename or any other thing, I cannot upload that specific ones. 
The only time the image shows up in Wordpress is when i try to edit it.
Does somebody have any idea? 
Thank you!

Answer: 
There are probably many different ways of doing that. One possibility is to pre-compute the correspondence tables between the two ranges.

```js
var slider = [
      document.getElementById('range-1'),
      document.getElementById('range-2')
    ],
    fromSlider = [ [], [] ];

function initSliderTables(step) {
  var p = 0;

  step.concat(0).forEach(function(s, i) {
    for(var j = 0; j <= s; j++) {
      fromSlider[1][p + j] = i + 1;
    }
    fromSlider[0][i + 1] = p;
    p += s;
  });
}

function update(from) {
  slider[from ^ 1].value = fromSlider[from][slider[from].value];

  document.getElementById('debug0').innerHTML = slider[0].value;
  document.getElementById('debug1').innerHTML = slider[1].value;
}

initSliderTables([ 4, 8, 16, 16, 24, 12 ]);
update(0);
```

```html
<input id="range-1" type='range' onchange="update(0)" min='1' max='7' step='1' />
<span id="debug0"></span><br>
<input id="range-2" type='range' onchange="update(1)" min='0' max='80' step='4' />
<span id="debug1"></span>
```

We can avoid the `for` loop by doing:

```
step.concat(1).forEach(function(s, i) {
  fromSlider[1] = fromSlider[1].concat(Array(s).fill(i + 1));
  fromSlider[0][i + 1] = p;
  p += s;
});

```

However, `.fill()` is not yet supported by all browsers.
A clean way could be to define an array with increments and use it to define range settings; in this sample I write a simple increment because I didn't understand what your exact needs, but this is the idea, then you can simply change the operation on 'change' event.

```
var increments = [0,4,8,16,16,24,12];

$('#range-3').attr('max', increments.reduce((a, b) => a + b, 0));
$('#range-3').attr('step', Math.min.apply(null,increments.slice(1,increments.length)));

$('#range-2').on('change', function() {
    $('#range-3').val($('#range-2').val() + increments[$(this).val()-1]);
});

```

[Here a sample jsfiddle](https://jsfiddle.net/berets/wL0gxxp7/)