PHP image tools and motion detection