Created
May 24, 2018 08:11
-
-
Save softberries/e7b0c762fe344475d7b2bceba4be9285 to your computer and use it in GitHub Desktop.
extract image data from request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkFace(tempFolderPath: String, signInData: Option[MultipartFormData[TemporaryFile]], credentials: Credentials, user: User): Future[Boolean] = { | |
signInData.map { fileData => | |
fileData.file("uploadedImage").map { image => | |
import java.io.File | |
val filename = image.filename | |
image.ref.moveTo(new File(s"$tempFolderPath/signIn-$filename.png")) | |
val bos = new BufferedOutputStream(new FileOutputStream(new File(s"$tempFolderPath/orig-$filename.png"))) | |
bos.write(user.face) | |
bos.close() | |
checkIfFacesMatch(s"$tempFolderPath/signIn-$filename.png", s"$tempFolderPath/orig-$filename.png") | |
}.getOrElse { | |
Future.successful(false) | |
} | |
}.get | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment