I just started using google cloud services and found that the following can be only implemented using blob but i want to use image name from cloud storage.
Is there a way to resize the images using servingURL if so how can i implement it i.e. how can i give the bucket name and image name from cloud storage ?
and construct the URL and pass the parameters
is there any blog or code that i can refer ?
The get_serving_url() is part of App Engine and thus you can't use it in Firebase (unless Firebase will eventually supports it), but you can definitely store the images in the Google Cloud Storage instead of Blobstore, which is by the way is the recommended way.
here is the blog to resize the image
This is the sample PHP code but how to make it working in FireBase you need to refer 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With