dirtybirdnj / vtj-final-final

its either this or nothing. final final for real verticaltubejig.com
https://vtj-final-final.vercel.app
0 stars 0 forks source link

pull image gallery data from cloudinary #11

Closed dirtybirdnj closed 1 year ago

dirtybirdnj commented 1 year ago

Use the cloudinary API to pull image arrays to feed into the masonry galleries

This should allow click and drag re-arrangement, resizing, etc of content with minimal code effort

Listing all from a directory

var cloudinary = require('cloudinary');

cloudinary.config({
 cloud_name: "xx", // add your cloud_name
 api_key: "xx", // add your api_key
 api_secret: "xx", // add your api_secret
 secure: true
});

cloudinary.v2.api.resources({
  type: 'upload',
  prefix: 'xx' // add your folder
},
  function(error, result) { console.log(result, error) });

searching

var cloudinary = require('cloudinary');

cloudinary.config({
 cloud_name: "xx", // add your cloud_name
 api_key: "xx", // add your api_key
 api_secret: "xx", // add your api_secret
 secure: true
});

cloudinary.v2.search.expression(
  'folder:xx/*' // add your folder
  ).sort_by('public_id','desc').max_results(30).execute().then(result=>console.log(result));
dirtybirdnj commented 1 year ago

homepage is manually curated, gallery page is almost automated

still need to have a better process to run the fetchCDNPhotos util once and have it create homepage and gallery array / file data

dirtybirdnj commented 1 year ago

new ticket for automation will be created. closing for grooming purposes.