title: Cannot convert Base64 jpg in GWT
body: <p>I'm having trouble converting URI encoded images in jpg format (png works fine).  My client side is a simple jquery ajax post.  On the server I'm simply trying to decode the image, resize it, and add it to the blobstore.  I'm currently learning JQuery, so if the problem is on the client side please dumb it down for me.  Thank you.</p>
  
  <p>Client: <br /></p>
  
  <pre><code>function send(target){
  
                  var sendInfo = { 
                              team: localStorage.getItem("teamName"),
                              name: target,
                              imagedata: image
                          };
  
  
                  $.mobile.loading( 'show', {
                      textVisible: false,
                      theme: 'z',
                      html: ""
                  });
  
                  $.ajax({
                      type: "POST",
                      url: "/UploadImage",
                      data: sendInfo
                      }).done(function(data) {
                          $.mobile.loading('hide');
                      })
                      .fail(function(data) {
                          $.mobile.loading('hide');
                  });
  </code></pre>
  
  <p>Server: <br /></p>
  
  <pre><code>public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws IOException {
          try {
  
          String team = req.getParameter("team");
          String name = req.getParameter("name");
          String imageData = req.getParameter("imagedata").replaceAll("data:image/[a-z]*;base64,", "");
          System.err.print("ImageData: " + imageData);
  
          Image image = ImagesServiceFactory.makeImage(Base64Utils.fromBase64(imageData));
          System.out.println(image.getHeight() + " : " + image.getWidth());
  
          } catch (Exception e) {
              e.printStackTrace();
          }
  }
  </code></pre>
  
  <p>Test Cases: <br /></p>
  
  <pre><code>ImageData(JPEG): data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAA...
  RETURNS: java.lang.IllegalArgumentException: imageData must be a valid image
  ImageData(PNG): data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQAAAALQCAIAAABAH0oBAAAAA3NCS...
  RETURNS: 720 : 1280 (i.e. it's working)
  </code></pre>