Initial commit: Salmakis Yachting Portal with Cloudinary & i18n
This commit is contained in:
59
scratch/bulk_upload.js
Normal file
59
scratch/bulk_upload.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const cloudinary = require('cloudinary').v2;
|
||||
require('dotenv').config({ path: '.env.local' });
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
cloudinary.config({
|
||||
cloud_name: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
|
||||
api_key: process.env.CLOUDINARY_API_KEY,
|
||||
api_secret: process.env.CLOUDINARY_API_SECRET
|
||||
});
|
||||
|
||||
const BASE_DIR = path.join('public', 'images');
|
||||
const CLOUDINARY_ROOT = 'salmakisyat';
|
||||
|
||||
async function uploadFolder(folderName) {
|
||||
const folderPath = path.join(BASE_DIR, folderName);
|
||||
if (!fs.existsSync(folderPath)) return [];
|
||||
|
||||
const files = fs.readdirSync(folderPath);
|
||||
const results = [];
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(folderPath, file);
|
||||
if (!fs.lstatSync(filePath).isFile()) continue;
|
||||
|
||||
console.log(`Uploading ${folderName}/${file}...`);
|
||||
try {
|
||||
const result = await cloudinary.uploader.upload(filePath, {
|
||||
folder: `${CLOUDINARY_ROOT}/${folderName}`,
|
||||
use_filename: true,
|
||||
unique_filename: false,
|
||||
overwrite: true
|
||||
});
|
||||
results.push({
|
||||
localFile: file,
|
||||
public_id: result.public_id
|
||||
});
|
||||
console.log(`Done: ${result.public_id}`);
|
||||
} catch (e) {
|
||||
console.error(`Failed to upload ${file}:`, e.message);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const folders = ['meira', 'melda', 'queenofsalmakis', 'dolcemare', 'sunworld'];
|
||||
const allResults = {};
|
||||
|
||||
for (const folder of folders) {
|
||||
console.log(`\n--- Processing folder: ${folder} ---`);
|
||||
allResults[folder] = await uploadFolder(folder);
|
||||
}
|
||||
|
||||
fs.writeFileSync('scratch/upload_report.json', JSON.stringify(allResults, null, 2));
|
||||
console.log('\nAll uploads completed! Report saved to scratch/upload_report.json');
|
||||
}
|
||||
|
||||
main();
|
||||
38
scratch/scan_cloudinary.js
Normal file
38
scratch/scan_cloudinary.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const cloudinary = require('cloudinary').v2;
|
||||
require('dotenv').config({ path: '.env.local' });
|
||||
|
||||
cloudinary.config({
|
||||
cloud_name: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
|
||||
api_key: process.env.CLOUDINARY_API_KEY,
|
||||
api_secret: process.env.CLOUDINARY_API_SECRET
|
||||
});
|
||||
|
||||
async function listResources() {
|
||||
try {
|
||||
console.log('Fetching assets from Cloudinary...');
|
||||
let allResources = [];
|
||||
let nextCursor = null;
|
||||
|
||||
do {
|
||||
const result = await cloudinary.api.resources({
|
||||
type: 'upload',
|
||||
prefix: 'salmakisyat/',
|
||||
max_results: 500,
|
||||
next_cursor: nextCursor
|
||||
});
|
||||
allResources = allResources.concat(result.resources);
|
||||
nextCursor = result.next_cursor;
|
||||
} while (nextCursor);
|
||||
|
||||
const mapping = allResources.map(res => ({
|
||||
public_id: res.public_id,
|
||||
folder: res.folder
|
||||
}));
|
||||
|
||||
console.log(JSON.stringify(mapping, null, 2));
|
||||
} catch (error) {
|
||||
console.error('Error fetching resources:', error);
|
||||
}
|
||||
}
|
||||
|
||||
listResources();
|
||||
248
scratch/upload_report.json
Normal file
248
scratch/upload_report.json
Normal file
@@ -0,0 +1,248 @@
|
||||
{
|
||||
"meira": [
|
||||
{
|
||||
"localFile": "GUEST-CABIN-3-1-1024x680.jpg",
|
||||
"public_id": "salmakisyat/meira/GUEST-CABIN-3-1-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "MASTER-CABIN-4-1024x680.jpg",
|
||||
"public_id": "salmakisyat/meira/MASTER-CABIN-4-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "MEIRA-2000x1333.jpg",
|
||||
"public_id": "salmakisyat/meira/MEIRA-2000x1333"
|
||||
},
|
||||
{
|
||||
"localFile": "MS-MEIRA-53-1-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/MS-MEIRA-53-1-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "MS-MEIRA-58-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/MS-MEIRA-58-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU3709-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU3709-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU3739-1-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU3739-1-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU3741-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU3741-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU3748-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU3748-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU3965-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU3965-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU4215-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU4215-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU4475-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU4475-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU4519-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU4519-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "PSU4814-1024x683.jpg",
|
||||
"public_id": "salmakisyat/meira/PSU4814-1024x683"
|
||||
},
|
||||
{
|
||||
"localFile": "VIP-CABIN-1-1024x680.jpg",
|
||||
"public_id": "salmakisyat/meira/VIP-CABIN-1-1024x680"
|
||||
}
|
||||
],
|
||||
"melda": [
|
||||
{
|
||||
"localFile": "balkon4-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/balkon4-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "master3-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/master3-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "master4-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/master4-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "mastertuvalet-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/mastertuvalet-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "mastertuvalet.jpg2_-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/mastertuvalet.jpg2_-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "masteryeni2-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/masteryeni2-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "twin1-768x432.jpg",
|
||||
"public_id": "salmakisyat/melda/twin1-768x432"
|
||||
},
|
||||
{
|
||||
"localFile": "yuzen-yat-2000x1125.jpg",
|
||||
"public_id": "salmakisyat/melda/yuzen-yat-2000x1125"
|
||||
}
|
||||
],
|
||||
"queenofsalmakis": [
|
||||
{
|
||||
"localFile": "kic-master-lumboz-1.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/kic-master-lumboz-1"
|
||||
},
|
||||
{
|
||||
"localFile": "Onaylanmayan 417802.crdownload",
|
||||
"public_id": "salmakisyat/queenofsalmakis/Onaylanmayan_417802"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-AFTDECK-1 (1).jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-AFTDECK-1_1"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-AFTDECK-1.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-AFTDECK-1"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-AFTDECK-4 (1).jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-AFTDECK-4_1"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-AFTDECK-4.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-AFTDECK-4"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-cabin-BOW-MASTER-7.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-cabin-BOW-MASTER-7"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-FOREDECK-6.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-FOREDECK-6"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-guverte-FOREDECK-2-scaled.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-guverte-FOREDECK-2-scaled"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-guverte-FOREDECK-4-scaled.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-guverte-FOREDECK-4-scaled"
|
||||
},
|
||||
{
|
||||
"localFile": "QOS-yelkenli-beyaz-7-2000x1333.jpg",
|
||||
"public_id": "salmakisyat/queenofsalmakis/QOS-yelkenli-beyaz-7-2000x1333"
|
||||
}
|
||||
],
|
||||
"dolcemare": [
|
||||
{
|
||||
"localFile": "Dolce-Mare-12-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-12-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-33-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-33-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-41-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-41-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-47-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-47-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-57-1024x680 (1).jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-57-1024x680_1"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-57-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-57-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-63-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-63-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-66-1024x680 (1).jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-66-1024x680_1"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-66-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-66-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-80-1024x680.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-80-1024x680"
|
||||
},
|
||||
{
|
||||
"localFile": "Dolce-Mare-90-2000x1328.jpg",
|
||||
"public_id": "salmakisyat/dolcemare/Dolce-Mare-90-2000x1328"
|
||||
}
|
||||
],
|
||||
"sunworld": [
|
||||
{
|
||||
"localFile": "784ff3f3e0fa5982c77288ecf6612842 (1).jpg",
|
||||
"public_id": "salmakisyat/sunworld/784ff3f3e0fa5982c77288ecf6612842_1"
|
||||
},
|
||||
{
|
||||
"localFile": "784ff3f3e0fa5982c77288ecf6612842.jpg",
|
||||
"public_id": "salmakisyat/sunworld/784ff3f3e0fa5982c77288ecf6612842"
|
||||
},
|
||||
{
|
||||
"localFile": "Aft-Double-Bed-Cabin.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Aft-Double-Bed-Cabin"
|
||||
},
|
||||
{
|
||||
"localFile": "bodrum-sunworld-8-kiralik-gulet-5 (1).jpg",
|
||||
"public_id": "salmakisyat/sunworld/bodrum-sunworld-8-kiralik-gulet-5_1"
|
||||
},
|
||||
{
|
||||
"localFile": "bodrum-sunworld-8-kiralik-gulet-5.jpg",
|
||||
"public_id": "salmakisyat/sunworld/bodrum-sunworld-8-kiralik-gulet-5"
|
||||
},
|
||||
{
|
||||
"localFile": "Double-Bed-Cabin-1.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Double-Bed-Cabin-1"
|
||||
},
|
||||
{
|
||||
"localFile": "Double-Bed-Cabin.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Double-Bed-Cabin"
|
||||
},
|
||||
{
|
||||
"localFile": "Sailing-Boat.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Sailing-Boat"
|
||||
},
|
||||
{
|
||||
"localFile": "Saloon.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Saloon"
|
||||
},
|
||||
{
|
||||
"localFile": "Sitting-Area.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Sitting-Area"
|
||||
},
|
||||
{
|
||||
"localFile": "Sunbeds-on-Deck.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Sunbeds-on-Deck"
|
||||
},
|
||||
{
|
||||
"localFile": "Toilet-1.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Toilet-1"
|
||||
},
|
||||
{
|
||||
"localFile": "Triple-Bed-Cabin.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Triple-Bed-Cabin"
|
||||
},
|
||||
{
|
||||
"localFile": "Twin-Bed-Cabin.jpg",
|
||||
"public_id": "salmakisyat/sunworld/Twin-Bed-Cabin"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user