def write_images(self, deployment_key, image_data):
        """
        Write the image, measurement and camera data to the db, for the given deployment.
        """

        for image_data_dict in image_data:

            date_time = datetime.datetime.strptime(image_data_dict['date_time'], '%Y-%m-%dT%H:%M:%S.%fZ')

            try:
                #save the image
                image = Image(deployment_id=deployment_key,
                              image_name=image_data_dict['image_name'],
                              image_path=image_data_dict['image_path'],
                              date_time=date_time,
                              position="SRID=4326;POINT("+str(image_data_dict['longitude'])+" "+str(image_data_dict['latitude'])+")",
                              image_type=image_data_dict['image_type']

                              )
                image.save()

                """
                self.write_measurement(image, 'depth', 'm', image_data_dict['depth'])
                self.write_measurement(image, 'depth_uncertainty', 'm', image_data_dict['depth_uncertainty'])
                self.write_measurement(image, 'temperature', 'cel', image_data_dict['temperature'])
                self.write_measurement(image, 'salinity', 'psu', image_data_dict['salinity'])
                self.write_measurement(image, 'pitch', 'rad', image_data_dict['pitch'])
                self.write_measurement(image, 'roll', 'rad', image_data_dict['roll'])
                self.write_measurement(image, 'yaw', 'rad', image_data_dict['yaw'])
                self.write_measurement(image, 'altitude', 'm', image_data_dict['altitude'])

                #link the camera to the image
                camera_data_dict = self.read_camera_data(image_data_dict)
                camera = Camera(**camera_data_dict)
                camera.image = image
                camera.save()
                """

            except django.db.utils.IntegrityError:
                print "Skipping %s, it already exists." % image_data_dict['image_name']

        return None