http://code.google.com/p/googleappengine/issues/detail?id=2990
Feel free to vote for it. :)
On Mar 16, 1:58 pm, Josh Rehman <j...@joshrehman.com> wrote:
> Do you think I should file a bug?
>
> On Sun, Mar 14, 2010 at 1:24 PM, JavaJosh <javaj...@gmail.com> wrote:
> > Hi there,
>
> > I'm new to Google App Engine, and was wondering what I'm doing wrong.
> > In my application, users upload (potentially large) images into the
> > Blobstore. I also need to create a thumbnail image that is 300px wide
> > (and high enough to maintain aspect ratio). Although
> > ImagesServiceFactory.makeImageFromBlob(blobKey) returns an Image
> > that's not null, when I try to access width and height properties of
> > the returned image I get an UnsupportedOperationException "No image
> > data is available.".
>
> > Here is the simplest code I can think of to reproduce (this is based
> > on blobstore example; to make it work setup that example, then add a
> > web.xml entry for this servlet and then change the "upload" servlet
> > mapping to point to it):
>
> > import java.io.IOException;
> > import java.util.Map;
> > import java.util.logging.Logger;
>
> > import javax.servlet.ServletException;
> > import javax.servlet.http.HttpServlet;
> > import javax.servlet.http.HttpServletRequest;
> > import javax.servlet.http.HttpServletResponse;
>
> > import com.google.appengine.api.blobstore.BlobKey;
> > import com.google.appengine.api.blobstore.BlobstoreService;
> > import com.google.appengine.api.blobstore.BlobstoreServiceFactory;
> > import com.google.appengine.api.images.Image;
> > import com.google.appengine.api.images.ImagesServiceFactory;
>
> > public class ImageBlobBug extends HttpServlet {
> > private static final long serialVersionUID = 1L;
> > private BlobstoreService blobstoreService =
> > BlobstoreServiceFactory.getBlobstoreService();
> > private static final Logger log =
> > Logger.getLogger(ImageBlobBug.class.getName());
>
> > public void doPost(HttpServletRequest req, HttpServletResponse res)
> > throws ServletException, IOException {
> > Map<String, BlobKey> blobs =
> > blobstoreService.getUploadedBlobs(req);
> > BlobKey blobKey = blobs.get("myFile");
> > Image image =
> > ImagesServiceFactory.makeImageFromBlob(blobKey);
>
> > res.sendRedirect("#"+ (image == null ? "Image could not be
> > made from
> > blob":"Image successfully retrieved with height: " +
> > image.getHeight()));
> > }
>
> > }
>
> > Here is the stacktrace:
>
> > java.lang.UnsupportedOperationException: No image data is available.
> > at
> > com.google.appengine.api.images.ImageImpl.updateDimensions(ImageImpl.java:
> > 130)
> > at
> > com.google.appengine.api.images.ImageImpl.getHeight(ImageImpl.java:
> > 63)
> > at ImageBlobBug.doPost(ImageBlobBug.java:27)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> > at
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > 487)
> > at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > 362)
> > at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > 216)
> > at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > 181)
> > at
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> > 712)
> > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > 405)
> > at
>
> > com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> > 70)
> > at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:268)
> > at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
> > at
>
> > com.google.appengine.api.blobstore.dev.UploadBlobServlet.handleUpload(UploadBlobServlet.java:
> > 368)
> > at com.google.appengine.api.blobstore.dev.UploadBlobServlet.access
> > $000(UploadBlobServlet.java:72)
> > at com.google.appengine.api.blobstore.dev.UploadBlobServlet
> > $1.run(UploadBlobServlet.java:100)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at
>
> > com.google.appengine.api.blobstore.dev.UploadBlobServlet.doPost(UploadBlobServlet.java:
> > 98)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> > at
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > 487)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1093)
> > at
>
> > com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> > 51)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1084)
> > at
>
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> > 43)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1084)
> > at
>
> > com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> > 121)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1084)
> > at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > 360)
> > at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > 216)
> > at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > 181)
> > at
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> > 712)
> > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > 405)
> > at
>
> > com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> > 70)
> > at
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > 139)
> > at com.google.appengine.tools.development.JettyContainerService
> > $ApiProxyHandler.handle(JettyContainerService.java:352)
> > at
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > 139)
> > at org.mortbay.jetty.Server.handle(Server.java:313)
> > at
> > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > 506)
> > at org.mortbay.jetty.HttpConnection
> > $RequestHandler.content(HttpConnection.java:844)
> > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
> > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
> > at
> > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> > 396)
> > at org.mortbay.thread.BoundedThreadPool
> > $PoolThread.run(BoundedThreadPool.java:442)
--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to google-appengine+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.