added on some image crop function nicked from somewhere