// web worker
self.onmessage = function(e) {

    var imgFrontArray = [];
    var imgContainer = e.data.imgContainer;
    var name = e.data.name;
    var id = e.data.id;
    var front_count = e.data.front_count;
  
    for (i = 0; i < front_count; i++) {
      console.log(i);
      //var img = document.createElement('img');
      var img = imgContainer[i];
          img.src = "img?id="+id+"&name="+name+"&type=front-resized&counter="+i;
          img.id = "img-front";
          img.style.width = 100 + '%';
      imgFrontArray[i] = img;   
    }  
    self.postMessage(imgFrontArray);
    
    //self.postMessage(e.data);
};

/*
var imgFrontArray = [];

self.addEventListener('message', function(e) {
  var name = e.name;
  var id = e.id;
  var front_count = e.front_count;

  for (i = 0; i < front_count; i++) {
      console.log(i);
      var img = new Image();
          img.src = "img?id="+id+"&name="+name+"&type=front-resized&counter="+i;
          img.id = "img-front";
          img.style.width = 100 + '%';
      imgFrontArray[i] = img;   
  }  
  self.postMessage(imgFrontArray);
}, false);
*/
