Android app how to get photos of a specific user - php

I'm creating a social app similar to instagram on Android studio.
Users will be able to upload and view photos in this app.
The photos are saved on a Cloud in a folder called "ProfileImage" and the URL of the photos is saved on the MySql database, along with the ID of the photo and the user's ID.
To get the photos I would like to use Picasso.
If for example the user A wants to look at his photos, the app will have to show him only his photos, that is I will have to get the URLs of the photos that have the id of the user A.
Picasso to get the photos use the following code Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);
But the problem is that I don't know the specific URL of the photos.
One solution I thought of is to get the URLs of the photos via PHP and pass them into an android variable that I will use as a URL variable for Picasso.
But this solution seems slow to me, in the sense that the photo will not be displayed immediately, but seconds will have to pass.
Can anyone recommend a faster and perhaps better solution than mine?

First of all, Upload your image to server and save image url inside mysql database not image itself. Create one api that returns user info including image url.

Related

Cache facebook/twitter profile image

I want to let the users upload their facebook/twitter profile picture as an avatar. I insert a record with their token/secret in the DB. I've made a script that gets the user's id and displays the profile image using readfile() but I want to cache this image for 30 minutes. Is this possible with codeigniter?
Although not codeigniter specific.. On a site I created - when the user logs in with facebook, we download the file using something similar to file_get_contents.. we then store our local reference to it along with a MD5 of the image data.. This allows us to easily check whether we need to update our local store when the profile is next requested (this does require the server to re-download from facebook)
In other instances, we store the file size that facebook reports, so that we can do a HTTP HEAD request to check easily if its changed (I realise size doesn't have a direct relationship to the image changing.. however 99.9% of the time its a good indication.

Workflow for photo upload with login and photo display online

Hello I am working on an educational app just for my own learning where a user can login, upload photos, and then have them display on a website. I am a little confused on the general idea of how it should work. I know this isn't the best place for this type of question but I can't find it anywhere else.
Basically I want a user to be able to login with something like OpenID and then upload a photo ( I am using phonegap and thus they would use the Phonegap API to do this and I understand the mobile side here ) to a server and then have be hosted on the server and be able to have a user's photos displayed together.
Do I need to have each photo be submitted to a database and if so how would I store the photo info? If you have any input it would be appreciated I am a little lost. I know php for the server side I just don't know what to do.
Do I need to have each photo be submitted to a database
Only if you want to, you would have the base64 encode it or store it as a blob though. Your best bet would be to store the image somewhere on your server outside of the database and instead store its address or path in a database along with a unique ID.
how would I store the photo info?
What photo info, the exif data? Or are you talking about additional general information? (date it was uploaded, user that uploaded it, etc etc) Either way, you would make a column in the database table for each chunk of data you want to store.
For example, if you wanted to store the date each photo was uploaded and which user uploaded it, you would set up columns in such a way that a row in the database that look something like this:
(columns) id photo user date
(row) 58 uploads/img58.jpg myuser192 1338483324
as for actually getting the photos on your server, perhaps you could use an html5 friendly solution like Uploadify

Auto generate PHP page for Facebook open graph

I'm trying to build an app on Facebook where users can upload their images, share it on their wall and get their friends to 'Like' their photo.
I'm not pretty sure how to do it, I have a page where a user uploads their picture and I would like them to have their own page upon picture uploaded so that their Facebook friends can 'Like' it.
Can I have 1 page with values or do I need to auto generate for each users?
This is like a Photo Contest.
You could use mysql database to store the data and call it using php when you want to see it, you will only have to create on page, and can automatically update itself when someone uploads a new picture, send to facebook and then store that data into the database so that it can easily be referenced again.

Uploading Videos in Graph API

I'm putting together an application in facebook, part of which requires a user to input a bunch of information into a form, including a video and a number of text fields.
For my application, I'm using a combination of HTML, PHP, mySQL and Javascript.
I want to be able to upload the users video file to facebook using the PHP SDK in the same page as I am inserting their info into my database. I want something similiar to the photo solution here: Exception when uploading photo with Facebook Graph API. But I'm not sure what the array key should be for the video itself.
Can any give me any ideas?
My apologies,
I realized that the solution I linked to works. However, you have to give facebook time to process the video, otherwise the graph api replies false.

Facebook application that allow users to upload image to the application album

I am trying to develope a facebook application that allows the users to create an album in my application and upload photos to it. I read some articles but those were very confusing. Could anyone tell me where I can get some simple article regarding this. I have no idea where to start from.
Thanks in advance.
The first thing is getting the user authenticated and with the corresponding permissions into your app (you will need special permissions to upload a picture into his albums, or creating a new one).
Once you have the permissions and therefore, the auth token, you can upload pictures by making post requests to the Graph API.
http://developers.facebook.com/docs/reference/api/photo/
Look at the bottom where it shows you an example using cURL.

Categories