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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTDPLIST1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<!-- ...the rest of info.plist --> | |
<key>CFBundleIcons</key> | |
<dict> | |
<!-- Default app icon --> | |
<key>CFBundlePrimaryIcon</key> | |
<dict> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTDPLIST1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<!-- ...the rest of info.plist --> | |
<key>CFBundleIcons</key> | |
<dict> | |
<!-- Default app icon --> | |
<key>CFBundlePrimaryIcon</key> | |
<dict> |
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
import * as functions from "firebase-functions"; | |
import * as admin from "firebase-admin"; | |
import * as express from 'express'; | |
import * as fs from "fs"; | |
import * as path from 'path'; | |
// Initialize Firebase Admin SDK | |
admin.initializeApp(); | |
// Initialize Express app |
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
StreamController<DetectedObject?> controller = StreamController<DetectedObject?>(); | |
void dispose() { | |
controller.close(); | |
} | |
void handle(DetectedObject data) async { | |
// Your handling logic for the detected object | |
} |
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
const CLOUD_FUNCTIONS_REGION = 'us-central1'; // Your functions region here | |
const COLLECTION_NAME = 'detectedObjects'; // Your specified collection here | |
export const processDetectedObjects = functions | |
.region(CLOUD_FUNCTIONS_REGION) | |
.firestore.document(`${COLLECTION_NAME}/{documentID}`) | |
.onCreate(async (snapshot) => { | |
try { | |
const objectsData = snapshot.data(); |
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
import * as functions from "firebase-functions"; | |
import * as admin from "firebase-admin"; | |
import * as fs from "fs"; | |
import * as path from 'path'; | |
const app = admin.initializeApp(); | |
const firestore = admin.firestore(app); | |
exports.post = functions.https.onRequest(async (req, res) => { | |
// Get post ID from url params |
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
import { CanvasRenderingContext2D, createCanvas, loadImage, registerFont } from 'canvas'; | |
import * as path from 'path'; | |
export async function createThumbnail(imageUrl: string, title: string, subtitle: string): Promise<Buffer> { | |
// Step 1: Pre-load font | |
registerFont(path.join(__dirname, '../assets/fonts/Poppins-Black.ttf'), { family: 'Poppins', weight: '900' }); | |
registerFont(path.join(__dirname, '../assets/fonts/Poppins-Regular.ttf'), { family: 'Poppins', weight: '500' }); | |
// Step 2: Create a canvas and load the image | |
// Note: 1200x630 is the recommended resolution for thumbnails |
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
import * as functions from "firebase-functions"; | |
import * as admin from "firebase-admin"; | |
import { getStorage, getDownloadURL } from 'firebase-admin/storage'; | |
import * as fs from "fs"; | |
import * as path from 'path'; | |
import { createThumbnail } from "./util/helpers"; | |
const app = admin.initializeApp(); | |
const firestore = admin.firestore(app); |