These 2 don't seem to be matching as intended:
if (preg_match('#_(a-d)\.jpg^#i', $url)) {
I want to match any urls that end with "_#.jpg" where # can be a, b, c, or d
and
} else if (preg_match('#_(1-4)\.jpg^#i', $url)) {
I want to match any urls that end with "_#.jpg" where # can be 1, 2, 3, or 4
Thanks in advance