Code

Support for Instagram App iOS Template + Web, Firebase (Photo&Video)

Support for Instagram App iOS Template + Web, Firebase (Photo&Video)

Cart 266 sales

Popular questions for this item

Can I limit video length to be uploaded

Sure, for video picker I’m using UIImagePickerController (System component) – file CreateViewController.swift[line:30]. So you need to set the maximum duration, and right after you select the video app will ask you to trim it. Please follow this documentation to find out more VideoMaximumDuration

What Admin Panel is available to control users and database?

Google Firebase is using as admin panel and can be used to control users, database, sending push notification and analytics. To find out more about it, please follow this link: http://firebase.google.com

What is an app template?

An app template is a pre-built application with a lot of the core functionality already implemented for you. It allows you to easily customize and add to the template’s code to create the kind of app you want.

export.sh: Permission denided

To avoid this, you need to turn on “execute” permissions for users (Xcode in this case) of the file.

Steps

  1. Go into terminal
  2. Navigate to where your script is
  3. run chmod 755 export.sh
more details here: https://stackoverflow.com/a/19522230/4977439

Content filtering with bluring offensive images

To filter content that potentially can contain nudity, pornography, or any other abusive content you can add these lines of code to your Could/functions/index.js file

This functionality not included as part of the project and need to be added manually to your cloud functions.

This solution will work for all your platforms: ios/android/web. Also, keep in mind Firebase takes extra for using Cloud Vision API

Before start:

  • Be sure you have Cloud Vision API Enabled
  • Be sure you have it enabled and your account <project-name>@appspot.gserviceaccount.com has this permission [Storage Object Admin and Storage Object Creator] in Google Console).
  • After adding lines below to Could/functions/index.js file be sure to re-deploy cloud functions again.
  • After deploying you should see blurOffensiveImages in you Cloud functions list
// file: Could/functions/index.js line 9:
admin.initializeApp();

// add code here
// Node.js core modules
const fs = require('fs');
const mkdirp = fs.promises.mkdir;
const { promisify } = require('util');
const exec = promisify(require('child_process').exec);
const path = require('path');
const os = require('os');

// Vision API
const vision = require('@google-cloud/vision');

/**
 * When an image is uploaded we check if it is flagged as Adult or Violence by the Cloud Vision
 * API and if it is we blur it using ImageMagick.
 */
exports.blurOffensiveImages = functions.storage.object().onFinalize(async (object) => {
    // Ignore things we've already blurred
    if (object.metadata.isSafe) {
        console.log(`Ignoring upload "${object.name}" because it was already safe.`);
        return null;
    }

    // Check the image content using the Cloud Vision API.
    const visionClient = new vision.ImageAnnotatorClient();
    const [data] = await visionClient.safeSearchDetection(
        `gs://${object.bucket}/${object.name}`
    );
    const safeSearchResult = data.safeSearchAnnotation;
    console.log(`SafeSearch results on image "${object.name}"`, safeSearchResult);

    // Tune these detection likelihoods to suit your app.
    // Available likelihoods are defined in https://cloud.google.com/vision/docs/reference/rest/v1/AnnotateImageResponse#likelihood
    if (
        safeSearchResult.violence == 'POSSIBLE' || safeSearchResult.violence == 'LIKELY' || safeSearchResult.violence == 'VERY_LIKELY' ||
        safeSearchResult.medical == 'POSSIBLE' || safeSearchResult.medical == 'LIKELY' || safeSearchResult.medical == 'VERY_LIKELY' ||
        safeSearchResult.racy == 'POSSIBLE' || safeSearchResult.racy == 'LIKELY' || safeSearchResult.racy == 'VERY_LIKELY'
    ) {
        console.log('Offensive image found. Blurring.');
        return blurImage(object.name, object.bucket, object.metadata);
    } else {
        object.metadata.isSafe = true
        const bucket = admin.storage().bucket(object.bucket);
        await bucket.file(object.name).setMetadata({ metadata: object.metadata })
    }

    return null;
});

/**
 * Blurs the given image located in the given bucket using ImageMagick.
 */
async function blurImage(filePath, bucketName, metadata) {
    const tempLocalFile = path.join(os.tmpdir(), filePath);
    const tempLocalDir = path.dirname(tempLocalFile);
    const bucket = admin.storage().bucket(bucketName);

    // Create the temp directory where the storage file will be downloaded.
    await mkdirp(tempLocalDir, { recursive: true });
    console.log('Temporary directory has been created', tempLocalDir);

    // Download file from bucket.
    await bucket.file(filePath).download({ destination: tempLocalFile });
    console.log('The file has been downloaded to', tempLocalFile);

    // Blur the image using ImageMagick.
    await exec(`convert "${tempLocalFile}" -channel RGBA -blur 0x8 "${tempLocalFile}"`);
    console.log('Blurred image created at', tempLocalFile);

    metadata.isSafe = true;

    // Uploading the Blurred image.
    await bucket.upload(tempLocalFile, {
        destination: `${filePath}`,
        metadata: { metadata: metadata }, // Keeping custom metadata.
    });
    console.log('Blurred image uploaded to Storage at', filePath);

    // Clean up the local file
    fs.unlinkSync(tempLocalFile);
    console.log('Deleted local file', filePath);
}

Where is documentation?

Please open index.html in the Documentation folder

Can I remove posts as admin?

Yes, if your user is admin you can remove any posts with Remove button

Show more

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey