What's size limit (if any) on base64 encoded images?

15,382 views
Skip to first unread message

Fran

unread,
Jun 15, 2011, 4:12:18 PM6/15/11
to Google Documents List API
Hi,
I would to know if there is a size limit on the images which I can
send in a doc by using base64 encoding.
In my app, I create an html doc with base64 encoded images.
Then, I create on google docs a new entry with mime type text/html,
but only sometimes (quite never) the images are displayed and I don't
know what the problem is.
So I was wondering if it could be an image size problem (also if I
don't think so).
Any ideas?
Thanks in advance,
Fran

Fran

unread,
Jun 16, 2011, 10:00:53 AM6/16/11
to Google Documents List API
I have done some tests.
I tried to low the quality of the image, but, still, only some images
are displayed.
Is there a limit on the length of the base64 string on GDocs?

Ali Afshar

unread,
Jun 16, 2011, 10:54:15 AM6/16/11
to Google Documents List API
Hi Fran,

You could host the images on a web server, and provide full URLs to
them in your HTML, then upload the document with convert. That should
fetch the images to save you embedding them.

Regards

--
Ali Afshar | @aliafshar | Google Developer Relations

Fran

unread,
Jun 16, 2011, 11:01:48 AM6/16/11
to Google Documents List API
Ali, thank you for the reply.
I can't host the images on a web server (different from GDocs) for
some reasons.
So I have two options:
- save the images on the GDocs account, trying to retrieve the urls
GDocs uses to store them and using these ones in the html doc (but, in
this way, both html doc uploading and downloading become very
complicated);
- use base64 encoding: now I'm trying this second option.
Regards,
Fran

Vic Fryzel

unread,
Jun 16, 2011, 11:05:44 AM6/16/11
to google-docum...@googlegroups.com
If anything, we follow the HTML specification here for the size of base64 embedded images in the HTML.

Have you considered using the Google Sites API?  That is setup to do everything you're trying to do here with a document.

-Vic

Fran

unread,
Jun 16, 2011, 11:30:34 AM6/16/11
to Google Documents List API
Vic, what html specification?
Unfortunately, I have to follow the customer's requests,
Regards,
Fran

Fran

unread,
Jun 18, 2011, 3:57:17 AM6/18/11
to Google Documents List API
Thanks to Vic, now I know the size limit on base64 encoded string
----
The images you embed in the HTML may not be more than 2MB in size nor
more than 2500x2500 pixels.

-Vic
----

I've done many tests: I can see image displaying (and not all images)
only if I use the lowest quality for a jpeg 320x460 image... about
4-8kb in size.
I don't know to what can be tied this problem.
Regards,
Fran

Vic Fryzel

unread,
Jun 18, 2011, 7:31:28 PM6/18/11
to google-docum...@googlegroups.com
I suspect your uploaded file size might be exceeding the overall maximum for a document.  What is the size of the HTML file you're sending?

-Vic

Fran

unread,
Jun 19, 2011, 3:03:53 AM6/19/11
to Google Documents List API
41 kb

Fran

unread,
Jun 20, 2011, 12:30:26 PM6/20/11
to Google Documents List API
The fact that some images appear when I use the lowest quality for
them, it suggests that actually it could be a problem of file size/
encoding length (as Vic suggested), but the files I'm trying to upload
are very small.
Moreover, in this way, not always images are displayed, also they are
about 4 or 8kb.
Now, I'm uploading images individually, but so I've many problems in
the importing stage.
Also if only for curiosity, I'd like to discover what could be the
problem.
Any suggestion is welcomed.
Fran
Reply all
Reply to author
Forward
0 new messages