我们如何使用firebase映像文件并使用get_Serving_URL调整它们的大小 [英] how can we use firebase image file and resize them using get_Serving_URL

查看:158
本文介绍了我们如何使用firebase映像文件并使用get_Serving_URL调整它们的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用谷歌云服务
,发现以下内容只能用blob实现,但是我想从云存储中使用映像名称。

有没有一种方法来调整使用serveURL图像,如果是这样的
我怎么能实现它,即我如何从云存储桶名称和图像名称?



并构建URL并传递参数

是否有我可以引用的任何博客或代码?

解决方案

这里是博客的大小调整图像

示例PHP代码,但如何使它在FireBase中工作,你需要参考下面的链接
点击这里阅读更多



index.php:<?php // var_dump($ _ FILES ['uploaded_files'] ['tmp_name']); syslog(LOG_WARNING,Request came); require_once'google / appengine / api / cloud_storage / CloudStorageTools.php ';使用google\appengine\api\cloud_storage\CloudStorageTools; syslog(LOG_WARNING,导入的云存储工具); // var_dump($ _GET); $ object_url = $ _ GET [image]; $ size = intval($ _ GET [size]); syslog(LOG_WARNING,Object URL $ object_url); syslog(LOG_WARNING,Size $ s ize); $ bucket =gs://YOUR-PROJECT-ID.appspot.com/bucket_name/; $ object_image_url = CloudStorageTools :: getImageServingUrl($ object_url,['size'=> $ size,'crop'=> ); syslog(LOG_WARNING,Output Url $ object_image_url); header(location:$ object_image_url); closelog();?> app.yaml:runtime:php55api_version:1handlers: - url:/.*script :index.php


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 ?

解决方案

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

这篇关于我们如何使用firebase映像文件并使用get_Serving_URL调整它们的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆