50,000 limit and Image Storing

1 view
Skip to first unread message

Пеђа

unread,
Dec 7, 2007, 6:03:24 AM12/7/07
to Google Chart API
OK, I totally understand the existence of a limit. And if G guys think
its 50;000 then so be it, I'm sure they will raise it sooner or later.

But in any case, does anyone know a way to get the image from G and
store it for later viewing?

I will use an example. I have a card game website and I would like to
show the user rating change graph. This graph does not change
frequently, the card game is such that it takes 30 minutes or more on
average to finish. So, worst case scenario this image would change
every 10-20 minutes.

Therefore, I would like to request the chart when users rating changes
and store this image in my DB and show it whenever someone opens that
profile. When the rating changes again, I request it again and store
it and I always show the image from my DB.

Or even better, I don't request the image until someone tries to open
the profile. So, if his rating changes 5 times before anyone opens his
profile, I have no pointless requests.

Any ideas?

Ian Bailey

unread,
Dec 7, 2007, 9:53:55 AM12/7/07
to Google Chart API
Depending on the language your website is developed in, you could
fetch the image from Google's servers, and store it locally on your
box, associating it with the request. "wget" could be used to download
the images if you can execute commands in a shell.

Some pseudo-code (sort of Ruby-ish):

def get_image(request_key)
graph = graph_associated_with(request_key)
if graph == not_found
local_graph = download_graph_from_google_to_my_machine()
associate_graph_with_request(request_key, local_graph)
graph = graph_associated_with(request_key)
end
return image_tag(graph)
end

Ian Bailey

unread,
Dec 7, 2007, 9:56:06 AM12/7/07
to Google Chart API
Forgot to add that you would need some logic here to invalidate your
existing chart based on whether your data had changed or not. This
would depend heavily on your specific application, though.

Пеђа

unread,
Dec 8, 2007, 4:35:37 PM12/8/07
to Google Chart API
THANKS for the reply.

I'm running Tomcat and PostgreSQL, so I'm thinking of just adding two
columns to one table where I will have the latest graph image and the
timestamp when it was created. Then, I know when the graph changes so
I will just update it when that happens.

Thanks again :)
Reply all
Reply to author
Forward
0 new messages