Query all photos from my cloud storage PHP

41 views
Skip to first unread message

Gas K.

unread,
Dec 16, 2016, 12:01:19 PM12/16/16
to Google App Engine
Hello i am new with app engine.

I am creating a gallery app.
I have some images in cloud storage and i want to retrieve them all with a query.

i have create a function like that but it doesnt work.

Any ideias???Thank you!

public static function find_all_photos($sql){
global $database;

$result_set = $database->query($sql);
while($row = mysqli_fetch_array($result_set)){
$photo = ($row['filename']);
$images_file = "gs://my-project-test-150523.appspot.com/".$photo;
CloudStorageTools::getImageServingUrl($images_file);

}
}


Nicholas (Google Cloud Support)

unread,
Dec 21, 2016, 12:30:30 PM12/21/16
to Google App Engine
Hay Gas K,

Welcome to the App Engine Google Groups!  If I understand your situation correctly, there are several photos stored in a Google Cloud Storage bucket.  You would like the your application to display the photos to the end user.

How is the list of photos determined?
If the list does not change, the paths to the images could be hardcoded though that's not a great practice.  More likely than not, the list will change.  Thus, you could use the PHP Client Llibrary with the Objects: list API to list the objects in a given bucket.  The result will contain the data you need to list the photos.

For a more dynamic user experience with likely less network overhead and if the list has very few restrictions, I would suggest using the Javascript client library from the client side to fetch images.  This can cut down some server traffic.

You mention that this the example you posted is not working?  What results are you seeing?
Reply all
Reply to author
Forward
0 new messages