I have a 1.5mb .png that I have to use on a site. No choice.
I only need in on a desktop though.
This project in a WordPress project, so It's PHP. My problem is that I can't seem to get a clean relative link path to use in the js and for the various scenarios I have going on between local and live.
PHP
<img src="<?php bloginfo('template_directory'); ?>/images/smaller-version-of-image" alt="yeah">
jQuery
var windowWidth = $(window).width();
if ( windowWidth > 1200 ) {
$('#flare01 img').attr('src','./images/larger-version-of-image.png');
}
There are a few factors. The local WP install is in the root. The live WP install lives in a subfolder but has it's setting set to the root. - so that is a WordPress specific part. The site points to mysite.com - but the WP is in mysite.com/phoebe
I don't really know why any of that should matter though – between the HTML and js fileMy logic is that my js file is in the js folder js/scripts.js in the root theme. The images are in the imagesfolder – so, pop out of the js, and then into the images ./images/image.png but that doesn't give me the correct path.