[Developers] trans service
Nick Thompson
nix at metaweb.com
Sun May 20 00:02:05 UTC 2007
Peter Boot wrote:
>
> I am trying understand how to display Wikipedia type content for a
> /film/film object similar to how it is done on
> http://www.freebase.com/view?id=%239202a8c04000641f80000000004b2047
>
> Is it correct the trans service needs to be used to do this ?
that's right. for example, the url for the image in that page uses
the id found in the topic .image property:
http://www.freebase.com/api/trans/image_thumb/%239202a8c04000641f800000000119cb42?maxwidth=120&maxheight=120
and the short blurb from the article is:
http://www.freebase.com/api/trans/blurb/%239202a8c04000641f80000000004b2051?maxlength=1000
(the id here came from the topic's .article property)
you can get the whole article as html using /trans/raw instead of /trans/blurb:
http://www.freebase.com/api/trans/raw/%239202a8c04000641f80000000004b2051
to include images through PHP, you can just generate an <img> tag:
<img
src="http://www.freebase.com/api/trans/image_thumb/%239202a8c04000641f800000000119cb42?maxwidth=120&maxheight=120">
</img>
you can include an article in a similar way using an <iframe src=> tag but
iframes don't give you much control of presentation. sometimes you'll need to
inline the article using PHP instead of just telling the browser to fetch it.
that's beyond my PHP knowledge, but it looks like the curl library should make
it pretty simple.
nick
The
> WhatsNew.html demo application from the manual returns an error saying
> that there are no new images. Do any examples exist showing how to use
> the trans service in PHP ?
>
> thanks
>
> Peter
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
More information about the Developers
mailing list