PHP Google Cloud Storage Tools getImageServingUrl

2019-07-23 22:48发布

I have PHP application running on google app engine which uses google cloud storage to store images.

I'm displaying images using CloudStorageTools::getImageServingUrl and the url is successfully pointed to images. I re-size the image using =sXXX format.

e.g: http://lh3.ggpht.com/AddEfddJKeiesklEaldaooea9as9e7de=s144

The problem is once I delete the previous image and replace it with another image using the same image name and it displays the older image. Even though I clear browser cache it doesn't solve. But when I remove =sXXX part from the url, it points to the new image without any problem at all. How can I overcome this?

Thanks & Regards!

2条回答
可以哭但决不认输i
2楼-- · 2019-07-23 23:02

Now a lot familiar with GAE PHP but I ll help a bit.

A serving url is persistent until (see answer here):

a. call delete_serving_url, or

b. delete the underling blob.

Now I've searched and the function CloudStorageTools::deleteImageServingUrl() exists for PHP so try calling that and then create a new one.

查看更多
做自己的国王
3楼-- · 2019-07-23 23:13

Add "?".microtime() to the URL generated by getImageServingUrl to force refresh.

查看更多
登录 后发表回答