Пример #1
0
def createImage():
	data = request.json

	try:
		cloudinaryImage = cloudinary.upload(data["file"], public_id = data["name"])
		cloudinaryImage["name"] = data["name"]

		image = database.save("images", cloudinaryImage)

		return database.dumpObject({"status": "success", "content": getImage(image)})
	except:
		return database.dumpObject({"status" : "error", "message": "The URL must be valid"})
Пример #2
0
def uploadImage():
	data = request.form

	try:
		cloudinaryImage = cloudinary.upload(request.files["file"], public_id = data["name"])
		cloudinaryImage["name"] = data["name"]

		image = database.save("images", cloudinaryImage)

		return database.dumpObject({"status": "success", "content": getImage(image)})
	except:
		return database.dumpObject({"status" : "error", "message" : "There was a problem uploading the image"})
Пример #3
0
def uploadImg(pic):
   """"
   this function is using in order to upload image file to cloudinary
   """
   json_response = upload(pic, public_id=pic)
   return json_response