Fix missing body images when site moved in subdirectory

/**
 * When site move to subdirectory, pictures, added in WYSIWYG, return old address
 * this small js fix it.
 */

(function($){
  $(document).ready(function() {
  
    if (Drupal.settings.basePath != '/') {
      $("body.page-node article .entry-content img").each(function() {
        var src = $(this).attr('src');
        $(this).attr('src', Drupal.settings.basePath + src);
      });
    }
  });
})(jQuery.noConflict());
Rating: 
10 out of 10 based on 4 ratings.
Tags: