Retrieving multiple images from firestore using pyrebase - firebase-storage

I'm using pyrebase to access my images stored in firebase storage for my python app. I access individual images via the below and this works fine:
path = "images/profile_photo/" + self.local_id + ".jpeg"
self.my_firestore.storage.child("images/profile_photo/" + self.local_id).download(path, "profile_picture.jpeg")
However, I need a user to be able to access lots of photos at once (coule be 50+). Is there a better way to retrieve the images than using .download() - is this going to download all the images and store them on the users phone? Would it not take lots of storage on the users phone?

Related

Upload image to meta ads using marketing api

I am trying to upload an image, get the image hash for use in creating an adcreative using meta marketing api on google colab, but i keep getting an empty list, don't know why that keeps happening.
i have properly authenticated and i am able to post ad campaigns, adsets remotely but i am unable to upload and image or view list of existing images/hash
path = '/content/drive/Shareddrives/Design/sampleimage.png'
image = AdImage('act_5**********')
image[AdImage.Field.filename] = path
image.remote_create()
image_hash = image[AdImage.Field.hash]
print(image)
even when i try to read the existing adimages i also get an empty lsit.
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
my_account = AdAccount('act_5**********')
fields = ['id','hash','name','original_height','original_width']
images = my_account.get_ad_images(fields=fields)
images
try uploading your images as .bmp, .jpeg, or .gif:

How to give each user a specific folder in the firebase storage

I have made an app that requires login authorization, and I want each user who has signed up for the app to have their own folder in the firebase storage. That way, all the data that gets passed to firebase is organized in separate folders for each user; keeping everything organized and the data easily accessible. I am wondering how to do this but am lost. I currently have firebase set up for my app but am struggling to figure this part out.
To allow users to only read/write their own files, have a look at the section on content-owner only access in the documentation on security rules.
to upload files to a user-specific folder, start by setting up a reference to the user folder:
let storageRef = storage.reference()
if Auth.auth().currentUser != nil {
let uid = Auth.auth().currentUser.uid
let userRef = storageRef.child()
...
And then follow the rest of the documentation on uploading files.

Access facebook data through Google Apps Script

I want to write a script on Google Apps Script which can access my Facebook friends list and sync the photo and other data with my Google contacts details.
I am trying to use FQL - but perhaps there is a better way. I have tried to read up a bit but can't really find where to begin - will I be able to access this via FQL or will I also need to write a Facebook application for this?
Has anyone attempted something similar or have any tips?
Edit: Ok, so I am trying to use a facebook app to access the data - but I can't even get it to return an access token.
Any ideas?
var url = "https://www.facebook.com/dialog/oauth?client_id={app_id}&redirect_uri=https://www.facebook.com/connect/login_success.html";
var response = UrlFetchApp.fetch(url);
var ret = response.getContentText();
Also, how can the token be stored in Google Apps Scripts? Would I need to create a new document and save the ID in that? It seems a bit messy..
For storing the token, I believe you can use the ScriptProperties facility:
Store:
ScriptProperties.setProperty("token", <your token goes here>);
Retrieve:
var token = ScriptProperties.getProperty("token");

Access Facebook albums from a flash app

I want to create a flash Facebook application in which, after pressing a button, the user will be able to browse his/her photo albums and choose a photo. How should i do that? What will be the code under the button to gain authentication from any user using this application?
Thanks.
I am currently writing a facebook application for a university assignment that will allow the user to do everything you can do in facebook, but via the flash player window. You will need a few basic things happening in order to do it.
User log in and authentication - this must be done via Facebook - using OAuth authentication, and meeting all of facebook's security policies
register the application with facebook
Use the Graph API (facebook's developer's toolkit) to get the necessary functions that will communicate with facebook via flash.
In Flash itself you will use a bunch of URLRequest functions to send out to FB for information, then you will need to retrieve that data responses and store them to variables (extracting data with a few lines of code is easy, something like this;
//initialise variables
public var photoURL:String;
var Request:URLRequest = new URLRequest("http://www.whatever the url for the graph api service you are using which is founf from FB");
//that ^^ will send off a request for the url, you then want to use the returned data by registering an event handler like this below
functionName.addEventListener(onComplete, completeHandler);
functionName(event, EVENT)
{
var loader:URLLoader = new URLLoader(Request);
var data:XML = new XMLData(load.loader); //i think this is right but not 100% sure, fiddle with it
//then you want to extract the data that is returned, for example, extracting xml data from a rest request works by hitting data from the xml by specifying a path to the object you want. an example of xml is this <rsp stat="ok"><photos ......more code="morecode"><photo url="url of photo"></photo</photos> so you can hit the url in that example like this;
photoURL = data.photos.photo.#url; //this line will grab the photo url for you, allowing you to dynamically create an array and assign photos to the flash stage according to the url you get
}
this is fairly advanced stuff and I am assuming that you have some decent knowledge on AS3, XML, and the FB API, if you need more help just reply

How to manage acc in iOS app?

I have a News Webserver where registered user can get RSS News. I want to build an iOS application use to get News from my webserver but i don't know how to manage acc in iOS application. How can i save logined user on iDevice ( store on .plis file, Core Data ....???, store real usr/pass or store encode user/pass), how can i verify stored user/pass with my Webserver? Anybody can help me :(
PS:
My current way:
In my iOS app:
+ User input usr+pass.
+ usr+pass send to webserver. If usr+pass is valid, webserver return token string(is encode string of usr+pass).
+ If webserver return token string, store token string into .plit file, else do notthing.
When user press "Get News"/
+ iOS send token string to webserver to verify. If valid return News of this usr acc, else return null.
How can i improved my current way to enhance security?
What you want to do is store your user's username in the applications preferences. See NSUserDefaults. You aren't allowed to store the user's password as plain text. What you should do instead is store it in the Keychain. See this guide for more information: Keychain Services Tasks for iOS.