Image resizing with images stores in Google Cloud Storage

4,145 views
Skip to first unread message

Ralf Rottmann

unread,
Apr 29, 2014, 8:36:46 PM4/29/14
to google-ap...@googlegroups.com
We favoured Google Cloud Storage over Blobstore as it seems to be the more future proven direction. However, the golang images package seems to only work with Blobstore. How would we resize images (think thumbnails) stored in Google Cloud Storage?

--

David Byttow

unread,
Apr 29, 2014, 8:43:37 PM4/29/14
to Ralf Rottmann, google-ap...@googlegroups.com
At least three options.

1. You can get a blobkey for a given filename in GCS (blobstore.BlobKeyForFile) and use that to create the serving URL.

2. You can also manipulate the URL itself by adding resize or crop parameters (see the bottom of this page: https://developers.google.com/appengine/docs/go/images/)

3. You can manipulate the raw bytes yourself with your favorite image library before storing in GCS.




--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ralf Rottmann

unread,
Apr 29, 2014, 9:56:28 PM4/29/14
to google-ap...@googlegroups.com, Ralf Rottmann
Thanks David,

I just implemented it, however, I find a very strange issue (a bug possibly):

Here is the URL generated:


When we invoke the resize service by adding, e.g. =s250 to the URL


we get a totally different image! Any idea?
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Glenn Lewis

unread,
Apr 29, 2014, 11:25:02 PM4/29/14
to Ralf Rottmann, google-appengine-go
If '=' is part of the image ID, then it needs to be URL quoted:
"=" is %3D
-- Glenn


To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.

Glenn Lewis

unread,
Apr 29, 2014, 11:26:29 PM4/29/14
to Ralf Rottmann, google-appengine-go
Oh, I see "=s250" is your resize command.
How about something like ...3IA?s=250
You need to separate the ID from the URL parameters.
-- Glenn

Ralf Rottmann

unread,
Apr 30, 2014, 4:17:19 AM4/30/14
to google-ap...@googlegroups.com, Ralf Rottmann
Glenn, it's not ours! :-) We use the blobstore resizing feature offered by Google Cloud Platform (see the paragraph about getServingUrl() here https://developers.google.com/appengine/docs/java/images/).

The =s20 is defined / required by you guys. :-) We opened an issue with Enterprise Support and they are investigating.

Thanks for taking care (again and again)!

On Wednesday, April 30, 2014 5:25:02 AM UTC+2, Glenn Lewis wrote:
If '=' is part of the image ID, then it needs to be URL quoted:
"=" is %3D
-- Glenn
On Tue, Apr 29, 2014 at 6:56 PM, Ralf Rottmann <ra...@rottmann.net> wrote:
Thanks David,

I just implemented it, however, I find a very strange issue (a bug possibly):

Here is the URL generated:


When we invoke the resize service by adding, e.g. =s250 to the URL


we get a totally different image! Any idea?

On Wednesday, April 30, 2014 2:43:37 AM UTC+2, David Byttow wrote:
At least three options.

1. You can get a blobkey for a given filename in GCS (blobstore.BlobKeyForFile) and use that to create the serving URL.

2. You can also manipulate the URL itself by adding resize or crop parameters (see the bottom of this page: https://developers.google.com/appengine/docs/go/images/)

3. You can manipulate the raw bytes yourself with your favorite image library before storing in GCS.


On Tue, Apr 29, 2014 at 5:36 PM, Ralf Rottmann <ra...@rottmann.net> wrote:
We favoured Google Cloud Storage over Blobstore as it seems to be the more future proven direction. However, the golang images package seems to only work with Blobstore. How would we resize images (think thumbnails) stored in Google Cloud Storage?

--

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsubscribe...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Glenn Lewis

unread,
Apr 30, 2014, 12:05:31 PM4/30/14
to Ralf Rottmann, google-appengine-go
Uh, Wow!  That certainly does not seem right.  I'll see what I can find out.


To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.

Glenn Lewis

unread,
Apr 30, 2014, 1:55:00 PM4/30/14
to Ralf Rottmann, google-appengine-go
I am told that the Image resize feature is meant to only work for immutable images.
Once you create an image in the blobstore (or GCS) and generate its publishing URL, you are not allowed to change the image, as thumbnails have already been created for it.

If you later overwrite that original image, the pre-calculated thumbnails will not necessarily update, and you will get the situation you see here.

Does this correctly describe your situation?  You created an image in the blobstore and then over-wrote it later?
If so, you will need to use unique names/keys for every new image that you upload to prevent this from happening in the future.

I hope that solves your problem.
-- Glenn
Reply all
Reply to author
Forward
0 new messages