How can we use the firebase image file and resize it with get_Serving_URL

I just started using google cloud services and found that the following can only be implemented with blob, but I want to use the image name from the cloud storage.

Is there a way to resize images using serveURL if that is how I can implement it, for example, how can I assign the name and the name of the bucket from the cloud storage?

and build the url and pass parameters

Is there any blog or code I can name?

+4
google-app-engine google-cloud-storage image firebase
source share
3 answers

here is a blog to resize the image

This is a sample PHP code, but how to make it work in FireBase, you need to pass the link below, click here to read more

index.php: <?php //var_dump($_FILES['uploaded_files']['tmp_name']); syslog(LOG_WARNING, "Request came"); require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php'; use google\appengine\api\cloud_storage\CloudStorageTools; syslog(LOG_WARNING, "Imported Cloud Storage Tools"); //var_dump( $_GET); $object_url=$_GET["image"]; $size=intval($_GET["size"]); syslog(LOG_WARNING, "Object URL $object_url"); syslog(LOG_WARNING, "Size $size"); $bucket="gs://YOUR-PROJECT-ID.appspot.com/bucket_name/"; $object_image_url = CloudStorageTools::getImageServingUrl($object_url,['size' => $size, 'crop' => false]); syslog(LOG_WARNING, "Output Url $object_image_url"); header("location: $object_image_url"); closelog(); ?> app.yaml: runtime: php55 api_version: 1 handlers: - url: /.* script: index.php 
+2
source share

get_serving_url () is part of the App Engine, and therefore you cannot use it in Firebase (if Firebase ultimately supports it) but you can save images to Google cloud storage instead of Blobstore, which, by the way, is recommended.

+1
source share

You can use the Firebase Javascript SDK to upload files to Google Storage and create sample APIs with the PHP + library from AppEngine to generate the URL of the object, this is the same place in the directory.

In a PHP application, be sure to place the following content in app.yaml :

 runtime: php55 api_version: 1 handlers: - url: /.* script: index.php 

Before that, using gcloud , deploy your sample API:

 gcloud app deploy 
0
source share

All Articles