[Phpmyadmin-devel] Base64 encoded images in HTML

Herman van Rink rink at initfour.nl
Fri Jun 18 16:02:38 CEST 2010

On 17-06-10 19:49, Martynas Mickevic(ius wrote:
> First of all pros:
>     * no additional request to fetch the image from server.

Which has as a big benefit that you don't need to store any intermediate
data in e.g. the php session. Or get it from MySQL again.

>     * image generation script can return multiple values. For example
>       the image itself and the image map (later used for tooltips) can
>       be returned.
> Cons
>     * some overhead is introduced when encoding binary data into
>       base64 format. On my experiment 46kB image was encoded into
>       60kB. (~30% overhead).
>     * Script execution is halted while the image generation is in
>       progress. This introduces slower response times for pages, which
>       show charts. (If the image is loaded in a "normal" way, in many
>       browsers page is started being rendered before images are
>       received from the server). This problem can be solved by writing
>       rendered charts to disk. However almost all planned charts are
>       going to display dynamic data (query results, profiling data,
>       query statistics).
>     * Generated images can not be linked to externally. (hardly a
>       problem for PMA)
> The only real problem that I see is the longer script execution times.
> However all the charts will be generated only on user request, so we
> can assume that the user knows that the chart is coming soon and
> expects to wait a little bit more.
> Both techniques are easy to implement. I have already images as base64
> strings working. Changing this would be a matter of minutes.
> What do you think?

Base64 images seems like an elegant solution to me. I agree that the
biggest drawback is the longer execution time. But in a scenario where
you want to have a fast loading UI and load these graphs in the
background, Javascript rendering would be available.
So it that case you would use a different rendering engine.

Met vriendelijke groet / Regards,

Herman van Rink 
Initfour websolutions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20100618/2584d4d8/attachment.html>

More information about the Developers mailing list