Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggregation Enquires Welcome

Example Interest Rates: Home Loan Variable: 2.54% (2.74%*) • Home Loan Fixed: 3.74% (3.48%*) • Fixed: 2.48% (2.94%*) • Variable: 2.54% (2.74%*) • Investment IO: 2.3% (3.76%*) • Investment PI: 2.04% (3.8%*)

State Library of Queensland Photograph Collection API

State Library of Queensland Photograph Collection API

Back in 2013, and then updated in 2015, the State Library of Queensland made around 50,000 copyright-expired images available via a 'Picture Queensland' collection. We took the fairly comprehensive CSV and XML data and created our own archive (of pre-1954 photographs) with a full-featured API to browse, search, and retrieve images. While the database is part of another one of our fairly broad projects, the collection in isolation is excellent, and its one we make available to all of our current and former clients. A WordPress plugin available via our client area creates a full library of the images with a search function on your own website.

The Result

Access to data is via the following endpoint: http://api.beliefmedia.com/australia/qld/qld.json. A number of parameters determine what information is returned.

id

If returning details for a single image, the image itemid is required along with your API Key. If an ID is passed via the URL, all other parameters will be ignored.

type & search

The type can be browse or search. If no type is defined and no id is present in the URL (to return a single result), browse will be used. If the type is search, a search term must be provided.

pg & number

The pg parameter determined the page to be returned. number determines how many results will be shown.

■ ■ ■

The first result shows how our JSON unfolds when searching a specific term or browsing results. A basic search, or simply browsing all paginated results, returns data in a similar manner. Request made was as follows: qld.json?apikey=xxx&pg=1&number=10&search=soldier.

1
Array
2
(
3
    [code] => 200
4
    [status] => 200
5
    [message] => OK
6
    [source] => State Library of Western Australia
7
    [page] => 1
8
    [number] => 30
9
    [pages] => 14
10
    [total] => 421
11
    [search] => Array
12
        (
13
            [type] => search
14
            [term] => soldier
15
        )
16
 
17
    [results] => Array
18
        (
19
            [0] => Array
20
                (
21
                    [itemid] => VM
22
                    [title] => Japanese General Adachi disembarking from a plane in Wewak, ready to surrender to the Australian Army, 1945
23
                    [creator] => Unidentified
24
                    [year] => 1945
25
                    [subject] => soldiers aeroplanes Japanese military uniforms World War II
26
                    [description] => Lieutenant General Hatazo Adachi (Commander Japanese 18th Army) arriving to meet with Major General Horace Robertson (GOC 6th Australian Division) where he handed over his sword and signed paperwork for the unconditional surrender of his forces in New Guinea, Cape Wom 13th September 1945. (Information taken from: Internet database 2005, retreived April 2005, from )
27
                    [location] => Wewak, New Guinea
28
                    [image] => Array
29
                        (
30
                            [full] => http://bishop.slq.qld.gov.au:80/webclient/DeliveryManager?pid=100129&custom_att_3=NLA
31
                            [thumbnail] => http://bishop.slq.qld.gov.au:80/webclient/DeliveryManager?pid=100130
32
                            [local_image] => 1945/VM.jpg
33
                            [local_thumbnail] => 1945/VM-t.jpg
34
                        )
35
 
36
                )
37
 
38
            [.. SNIP ..]
39
 
40
            [29] => Array
41
                (
42
                    [itemid] => AWj
43
                    [title] => Pen for scrap aluminium donations to the war cause, Brisbane, 1942
44
                    [creator] => Unidentified
45
                    [year] => 1942
46
                    [subject] => soldiers men's clothing and accessories children's clothing hats enclosures military uniforms World War II - Brisbane, 1942 Brisbane (Qld.)
47
                    [description] => Soldiers and a young boy are studying the donations inside the wooden pen. A well dressed gentleman stands to one side.
48
                    [location] => Brisbane, Queensland
49
                    [image] => Array
50
                        (
51
                            [full] => http://bishop.slq.qld.gov.au:80/webclient/DeliveryManager?pid=102827&custom_att_3=NLA
52
                            [thumbnail] => http://bishop.slq.qld.gov.au:80/webclient/DeliveryManager?pid=102829
53
                            [local_image] => 1942/AWj.jpg
54
                            [local_thumbnail] => 1942/AWj-t.jpg
55
                        )
56
 
57
                )
58
 
59
        )
60
 
61
)

To return details for a single result we provide only our apikey and the itemid. So, qld.json?apikey=xxxx&id=k5 returns the following:

1
Array
2
(
3
    [code] => 200
4
    [status] => 200
5
    [message] => OK
6
    [source] => State Library of Queensland
7
    [data] => Array
8
        (
9
            [itemid] => k5
10
            [title] => Staged photograph taken at the Trocadero
11
            [alternative_title] =>
12
            [creator] => Unidentified
13
            [subject] => evening clothes backdrops Social, 1930 - 1940 Brisbane (Qld.)
14
            [description] => Staged photograph of three couples leaning over the bow of a boat, part of the evening festivities at the Trocadero in South Brisbane.
15
            [publisher] => John Oxley Library, State Library of Queensland
16
            [contributor] =>
17
            [date] => ca. 1940
18
            [year] => 1940
19
            [image] => Array
20
                (
21
                    [full] => http://bishop.slq.qld.gov.au:80/webclient/DeliveryManager?pid=100001&custom_att_3=NLA
22
                    [thumbnail] => http://bishop.slq.qld.gov.au:80/webclient/DeliveryManager?pid=100002
23
                    [local_image] => images/1940/k5.jpg
24
                    [local_thumbnail] => images/1940/k5-t.jpg
25
                    [digiviewer] => 67079
26
                    [identifier] => 79937
27
                    [format] => Array
28
                        (
29
                            [type] => Digital format: image/jpeg
30
                            [details] => Original format: copy print : b&w
31
                        )
32
 
33
                )
34
 
35
            [geo] => Array
36
                (
37
                    [location] => Brisbane, Queensland
38
                    [latitude] => -27.46888
39
                    [longitude] => 153.022827
40
                )
41
 
42
            [reference] => Array
43
                (
44
                    [related] => Array
45
                        (
46
                        )
47
 
48
                    [category] => Array
49
                        (
50
                            [0] => Picture Queensland
51
                            [1] => State Library of Queensland : digital image collection
52
                        )
53
 
54
                    [category_string] => picture queensland,state library of queensland : digital image collection
55
                )
56
 
57
            [rights] => Copyright expired. For further information http://www.slq.qld.gov.au/home/copyright
58
        )
59
 
60
)

Reference Data

The reference array key provides details of the record as hosted on the SLQLD server. The related array, for example, provides links to related material or 'see more' galleries. Other data associated with the image is documented in more details in our client area. The digiviewer value, for example, is associated with the DigiToolViewer used to view high quality scans (http://hdl.handle.net/10462/deriv/{digiviewer}), and the identifier is usually a Negative number.

Image Data

The image links provided by the SLQLD are of reasonable web quality. Linking to the permanent record as described above provides access to the full resolution version.

We've copied all images locally, and each image reference on our own server is returned in the JSON data. A zip file containing all the images and thumbnails may be downloaded via our client area (22.45GB). Our image structure is as follows: images/{year}/{itemid.jpg}, and this structure is retained in the download file.

Sample PHP Functions

The following are the most basic of functions necessary to retrieve data. An API Key is provided to all clients and is available to others upon request.

Browsing or Searching Results

1
<?php 
2
/*
3
 State Library of Queensland Photograph Collection API
4
 https://www.beliefmedia.com.au/slqld-photograph-api
5
*/
6
 
7
function beliefmedia_slqld_photos($page = '', $number = '', $type = false, $search = false, $apikey = 'xxxxx') {
8
 
9
  if ($page == '') $page = '1';
10
  if ($number == '') $number = '20';
11
  if ($type === false) $type = 'browse';
12
 
13
  $type = ($type == 'browse') ? 'browse' : 'type=' . $type . '&search=' . str_replace(' ', '+', $search);
14
 
15
  $data = @file_get_contents('http://api.beliefmedia.com/australia/qld/qld.json?apikey=' . $apikey . '&pg=' . $page . '&number=' . $number . '&' . $type);
16
  if ($data === false) return false;
17
 
18
  $data = json_decode($data, true);
19
  if ($data === false) return false;
20
 
21
  /* Likely return array of errors with code & message */
22
  if ($data['code'] != '200') return $data['message'];
23
 
24
 return (array) $data;
25
}

Returning Single Result

1
<?php 
2
/*
3
 State Library of Queensland Photograph Collection API
4
 https://www.beliefmedia.com.au/slqld-photograph-api
5
*/
6
 
7
function beliefmedia_slqld_photos_detail($id, $apikey = 'xxxxx') {
8
 
9
  $data = @file_get_contents('http://api.beliefmedia.com/australia/qld/qld.json?apikey=' . $apikey . '&id=' . $id);
10
  if ($data === false) return false;
11
 
12
  $data = json_decode($data, true);
13
  if ($data === false) return false;
14
 
15
  /* Likely return array of errors with code & message */
16
  if ($data['code'] != '200') return $data['message'];
17
 
18
 /* Do something with data */
19
 return (array) $data;
20
}

If the code returns anything other than 200 an error has occurred. The most common error is 404 (not found), and this applies when a request is made for an image record or paginated result that doesn't exist.

Considerations

  • A large number of results are geo-tagged. You may search results within a specific radius of a latitude and longitude with the type of geo (type=geo&lat=xxx&lng=xxx). Documentation available in our client area.
  • We'll be modifying the subject field soon than later (the default field is a little bit of a mess). If you plan on using this data in an application we suggest you hold off for a couple of weeks.

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Connecticut)

  Want to have a chat?
 

RELATED READING

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment