The problem: Only pattern-like images are supposed to be uploaded and be used as backgrounds to a site, photos should not. How would you detect if an image looks enough like itself to be regarded as a pattern?
I'm no expert in image processing, but generally, repeating patterns can be identified relatively easily in the frequency domain. This is true for signal as well as image processing.
From what I understand of your question, you want to check that each image is composed almost completely of some repeating pattern, and reject those which are not (for example, photos).
You might want to try a Fast Fourier Transform of the image, and look for peaks in the frequency domain. Here is a similar question on SO, and this accepted answer gives good suggestions - try FFT, Wavelet analysis and auto-correlation, in that order of chance of working effectively. The other answers also give links to good references, especially this link.
Most of these references look for unknown repeating patterns in a given image, and locate those patterns. You would need to perform some post-processing on this that ensures that the repeating pattern (almost) completely covers your image, and not a small portion of the image. This should rule out repeating patterns in parts of the image, say the pattern on a person's shirt.