When using images on a site, retina.js automatically looks for an image in the same folder with the same name with the added @2x
, and then swaps out if the user has a high-DPI screen.
What I am trying to do is to tell retina.js to instead look for this retina @2x
image in a sub folder. So if I'm using image.png
, I want retina.js to look for image@2x.png
in a subfolder named Retina
for example.
I won't get into why I need this, but that is the gist of it. So then, is this possible, and where do I do this? I've found this part of retina.js that looks like it could do something along the lines of what I want, but I'm not sure how to proceed.
function RetinaImagePath(path, at_2x_path) {
this.path = path || '';
if (typeof at_2x_path !== 'undefined' && at_2x_path !== null) {
this.at_2x_path = at_2x_path;
this.perform_check = false;
} else {
if (undefined !== document.createElement) {
var locationObject = document.createElement('a');
locationObject.href = this.path;
locationObject.pathname = locationObject.pathname.replace(regexMatch, suffixReplace);
this.at_2x_path = locationObject.href;
} else {
var parts = this.path.split('?');
parts[0] = parts[0].replace(regexMatch, suffixReplace);
this.at_2x_path = parts.join('?');
}
this.perform_check = true;
}
}
Thank you.