iMagine implimentation in PHP