I have been asked to provide a solution to this problem as part of the selection process for a job. I have limited experience of PHP, however when I told my potential employer this they were happy for me to spend some time researching the following problem:
"We have a dynamic online magazine. Each page of the magazine contains an image and an article. Your problem is to dynamically colour the article text and the article background to match the colours that are present in the image, making considerations for readability and accessibility. Justify your choice of colour and explain any extensions to this that you feel would enhance the solution."
This is some of the most advanced stuff I've seen around here in ages. I'd be interested to know if there'd be a way to calculate a proper contrast between the text and the background as well. Also, you really don't need the tables, but that's not a big deal considering the bigger picture.