We have an image server that keeps cached versions of different sizes of images. The image filenames are in the format _wh.jpg
The 'w' and h' numbers are optional. Examples of possible requests are:
1234.jpg, 1234_w200.jpg, 1234_w200h160.jpg, 1234_h160.jpg
I need to be able to split these parameters out using PHP and a Regular Expression but can't work out how to do it (my regex experience is very limited). A key thing is that if only a width is passed as opposed to both a width and a height, I need to know that it's a width and not a height (if that makes sense).
Thanks in advance!