-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d10a65
commit ac3b720
Showing
24 changed files
with
253 additions
and
131 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
require('dotenv').load(); | ||
var fs = require('fs'); | ||
require('dotenv').config(); | ||
var cloudinary = require('cloudinary').v2; | ||
|
||
var uploads = {}; | ||
// File upload | ||
async function UploadImageByCloudinary(imgData){ | ||
console.log(imgData); | ||
try{ | ||
const image = await cloudinary.uploader.upload(imgData); | ||
// console.log(); | ||
// console.log("** File Upload"); | ||
// console.log("* public_id for the uploaded image is generated by Cloudinary's service."); | ||
// console.log("* " + image.public_id); | ||
// console.log("* " + image.url); | ||
// waitForAllUploads("pizza", err, image); | ||
return image.url; | ||
} | ||
catch(err){ | ||
console.log(err); | ||
}; | ||
} | ||
|
||
// set your env variable CLOUDINARY_URL or set the following configuration | ||
/* cloudinary.config({ | ||
cloud_name: '', | ||
api_key: '', | ||
api_secret: '' | ||
}); */ | ||
// UploadImageByCloudinary("aquaman.jpg"); | ||
|
||
console.log("** ** ** ** ** ** ** ** ** Uploads ** ** ** ** ** ** ** ** ** **"); | ||
|
||
// File upload | ||
cloudinary.v2.uploader.upload('pizza.jpg', { tags: 'basic_sample' }, function (err, image) { | ||
console.log(); | ||
console.log("** File Upload"); | ||
if (err) { console.warn(err); } | ||
console.log("* public_id for the uploaded image is generated by Cloudinary's service."); | ||
console.log("* " + image.public_id); | ||
console.log("* " + image.url); | ||
waitForAllUploads("pizza", err, image); | ||
}); | ||
module.exports = {UploadImageByCloudinary:UploadImageByCloudinary}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.