system.kanoa.cmms.processWorkOrderEventImage(filePath, workOrderEventId, workOrderEventImageId, imageName, imageType, imageDescription, userId)
Given the filesystem path to a raw uploaded image, this function converts the image to JPG format, generates a thumbnail, and stores both in the database as an image attached to a work order event.
It is the work-order-event-specific sibling of the generic processImage function, handling workOrderEventId/workOrderEventImageId association instead of a generic entity id.
Parameters
filePath String: Path to the image file
workOrderEventId Integer: Id of check item. Can be None
workOrderEventImageId Integer: Id of image. Can be None for a new image
imageName String: Name for the image
imageType String: Type of the image. Can be user defined.
imageDescription String: Description of the image
userId Integer:Id of the user executing the function
Returns
workOrderEventImageId Integer
message String None if success
Example
filePath = "C:\\Temp\\uploads\\meter_photo_raw.png"
workOrderEventId = 8842
workOrderEventImageId = None
imageName = "Meter Reading - Pump 3"
imageType = "Meter Reading"
imageDescription = "Photo of analog meter reading taken during PM inspection"
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
workOrderEventImageId, message = system.kanoa.cmms.processWorkOrderEventImage(filePath, workOrderEventId, workOrderEventImageId, imageName, imageType, imageDescription, userId)
print workOrderEventImageId, message