A.M.N.Bandara
A.M.N.Bandara

Reputation: 1508

PHP Google Cloud Storage Tools getImageServingUrl returns old image

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!

Upvotes: 1

Views: 1441

Answers (2)

Victor Bautista
Victor Bautista

Reputation: 1

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

Upvotes: 0

Jimmy Kane
Jimmy Kane

Reputation: 16845

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.

Upvotes: 2

Related Questions