Hello Dennis,

Just to be clear the variable BLOB_STORE in your code represents the Files
API accessing Google Cloud Storage, correct? Can you post that code as
well?

Secondly, if you are using Google Cloud Storage to save your images in,
then you need to use a different function to create your ServingUrlOptions.
Instead of using ServingUrlOptions.Builder.withBlobKey (which is reserved
for images coming from AppEngine's Blobstore), you need to use
ServingUrlOptions.Builder.withGoogleStorageFileName (files from GCS).
Here's the relevant documentation:
https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/images/ServingUrlOptions.Builder.


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

My Go side project: http://invalidmail.com/


On Mon, Jun 17, 2013 at 3:02 PM, dennis <[email protected]> wrote:

> Here's the code:
>
> public static String getNotFoundUrl(int size) {
>     try {
>       BlobKey blob_key =
> BLOB_STORE.createGsBlobKey("/gs/web_content/placeholder_img.png");
>
>       // Simple Test to make sure blob_key points at the right thing.
>       byte[] image_data = BLOB_STORE.fetchData(blob_key, 0, 100);
>       Application.getLogger().warning(new String(image_data));
>       // This parts works and gets the first 100 bytes.
>
>       ServingUrlOptions opts =
> ServingUrlOptions.Builder.withBlobKey(blob_key);
>       if(size > 0) opts.imageSize(size);
>       return IMAGES_SERVICE.getServingUrl(opts);
>     } catch(IllegalArgumentException e) {
>       Application.getLogger().warning("Unable to serve placeholder image
> from Cloud Storage.");
>       Application.getLogger().warning(e.getMessage());
>       Application.logException(e);
>       return "/placeholder_img.png";
>     }
>   }
>
> The fetchData call succeeds and I successfully read the first 100 bytes of
> the file that way. But the getServingUrl fails with
> IllegalArgumentException.
>
> java.lang.IllegalArgumentException:
> at 
> com.google.appengine.api.images.ImagesServiceImpl.getServingUrl(ImagesServiceImpl.java:282)
>
>
> Any ideas on why this happens will be much appreciated.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to