One of the common mistakes people do when change the image source is not waiting for image load to do afterward actions like maturing image size etc.
You will need to use jQuery .load() method to do stuff after image load.
$('yourimageselector').attr('src', 'newsrc').load(function(){
  $(this).width(); // this is how you get new width of image
});
 You may need to do this.width; instead if your images are in memory; $(this).width() will not work there.