fixed img_to_jpg for non-standard WP setups closes #269