API and Tools
/
Get, Update, Post and Delete Photos

Show photos of locr on your Website or in your program


With the locr API, you can show the locr photos on your website or in your own program. The locr placed photos are perfectly suitable to illustrate your own maps, words and datasets, where places are in focus (e.g. immovables, hotels, routes, resorts).


functionality:

It's a very simple REST-API, you only have to do a GET-Request

1. Functions:

1.1. get_photos: Demo

1.1.1. Parameter
User Authorization
photo_id or photo_name:
Get one specified photo
latitudemin, latitudemax, longitudemin, longitudemax:
The latitude has to be between -90 and 90 and the longitude has to be between -180 and 180.
center_latitude, center_longitude:
The latitude has to be between -90 and 90 and the longitude has to be between -180 and 180.
start:
Start value from database (Standard = 0)
count:
maximum numbers of entries (Standard = 10, max = 500)
category:
  • popularity (Popular Photos) (Standard)
  • rating (Highest Rated Photos)
  • created
  • submitted (Latest Photos)
  • distance (Distance combined with coordnates produces Longitude and Latitude (thus making a "Geotag"))
is_geotagged:
  • 1 (Can receive photos that are Geotagged) (Standard)
  • 0 (Can receive photos without Geotag)
  • off (Can receive photos with and without Geotag)
user_name, user_id or album_id
search_tag:
Search value for tag
search_city:
Search value for a city
search_caption:
Search value for a caption
search_description:
Search value for a description
start_date:
State date description from when the photos where shot in format "MM-DD-YYYY".
end_date:
Declaration, until the photos where shot in format "MM-DD-YYYY".
size:
  • original
  • large (1024x768)
  • medium (500x375)
  • small (240x180)
  • thumbnail (100x75)
  • square (100x100) (Standard)
If the parameter "size" is not set, the link for the photo has to be created as follows: <path><photo-name><size-ext>.<photo-ext> e.g.: http://www.locr.com/photos/000/ed/b3/edb307d24849b30243a1f6feaeae5380_T.jpg
locr:
  • true = Places (Standard)
  • false = All photos
1.1.2. Examples
http://www.locr.com/api/get_photos_xml.php?latitudemin=10&longitudemin=10&latitudemax=80&longitudemax=80&category=popularity&locr=true
http://www.locr.com/api/get_photos_json.php?latitudemin=10&longitudemin=10&latitudemax=80&longitudemax=80&category=popularity&locr=true

1.2. update_photo: Demo

1.2.1. Parameter
User Authorization*
photo_id or photo_name*:
caption:
Caption of the photo
description:
Description of the photo
tags:
Your texts are separated by commas
privacy:
  • 0 -> Public (Standard)
  • 500 -> Friends
  • 800 -> Family
  • 1000 -> Private
latitude:
Value between -90 and 90
longitude:
Value between -180 and 180
object_latitude:
Value between -90 and 90
object_longitude:
Value between -180 and 180
direction:
Direction that where photographed (0-360)
add_to_album_id or add_to_album_name:
Add this photo to the specified album.
1.2.2. Examples
http://www.locr.com/api/update_photo_xml.php?auth_user_name=testuser&api_signature=8b55eac3b2291b201fc59cd8b76410ab&auth_token=c8b066236c8cbcc280921b93f24e281a&photo_id=123456789&caption=testupdate
http://www.locr.com/api/update_photo_json.php?auth_user_name=testuser&api_signature=8b55eac3b2291b201fc59cd8b76410ab&auth_token=c8b066236c8cbcc280921b93f24e281a&photo_id=123456789&caption=testupdate

1.3. delete_photo: Demo

1.3.1. Parameter
User Authorization*
photo_id or photo_name*
1.3.2. Examples
http://www.locr.com/api/delete_photo_xml.php?auth_user_name=testuser&api_signature=8b55eac3b2291b201fc59cd8b76410ab&auth_token=c8b066236c8cbcc280921b93f24e281a&photo_id=123456789
http://www.locr.com/api/delete_photo_json.php?auth_user_name=testuser&api_signature=8b55eac3b2291b201fc59cd8b76410ab&auth_token=c8b066236c8cbcc280921b93f24e281a&photo_id=123456789

1.4. post_photo:

1.4.1. Parameter
The same optional parameters as in update_photo plus the required "file" parameter below.
User Authorization*
file* (HTTP-POST Method)
The file to upload
direction:
Direction that where photographed (0-360)
photo_conv_bg:
  • true = Creates the photosizes in the background (faster response time)
  • false = (Standard)
1.4.2. Examples
http://www.locr.com/api/post_photo_xml.php
http://www.locr.com/api/post_photo_json.php

2. Example answers:

XML JSON
<?xml version="1.0"?>
<photo_list status="ok" thumbnail_ext="_T" square_ext="_SQ" small_ext="_S" medium_ext="_M" large_ext="_L"
            original_ext="">
  <photos>
    <photo path="http://www.locr.com/photos/000/ed/b3/" name="edb307d24849b30243a1f6feaeae5380"
           ext="jpg" width="1600" height="1200" comments_count="3">
      <photo_id>1234567</id>
      <photo_url>http://www.locr.com/photo_detail.php?id=1234567</photo_url>
      <photo_file_url>
        http://www.locr.com/photos/000/ed/b3/edb307d24849b30243a1f6feaeae5380_SQ.jpg
      </photo_file_url>
      <privacy>0</privacy>
      <latitude>51.947616</latitude>
      <longitude>10.5649</longitude>
      <object_latitude>0</object_latitude>
      <object_longitude>0</object_longitude>
      <direction>15</direction>
      <location_name>test-location</location_name>
      <location>
        <continent>Europe</continent>
        <country>Germany</country>
        <country_capital>Berlin</country_capital>
        <state>Lower Saxony</state>
        <city>Braunschweig</city>
        <street>Rebenring</street>
      </location>
      <caption>test</caption>
      <description>test description</description>
      <tags>test, photo 1</tags>
      <created>0000-00-00 00:00:00</created>
      <submitted>2007-09-20 14:12:16</submitted>
      <user_name>testuser</user_name>
      <user_url>http://www.locr.com/profile/testuser</user_url>
    </photo>
    <photo path="http://www.locr.com/photos/000/76/fa/" name="76faddc60a6aa3f096c4b5e1230cbbc5"
           ext="jpg" width="1600" height="1200" comments_count="5">
      <photo_id>1234568</id>
      <photo_url>http://www.locr.com/photo_detail.php?id=1234568</photo_url>
      <photo_file_url>
        http://www.locr.com/photos/000/76/fa/76faddc60a6aa3f096c4b5e1230cbbc5_SQ.jpg
      </photo_file_url>
      <privacy>0</privacy>
      <latitude>51.225005</latitude>
      <longitude>6.775627</longitude>
      <object_latitude>0</object_latitude>
      <object_longitude>0</object_longitude>
      <direction>234</direction>
      <location_name>test-location2</location_name>
      <location>
        <continent>Europe</continent>
        <country>Germany</country>
        <country_capital>Berlin</country_capital>
        <state>North Rhine-Westphalia</state>
        <city>Duisburg</city>
        <street></street>
      </location>
      <caption>test2</caption>
      <description>test description 2</description>
      <tags>test, photo 2</tags>
      <created>0000-00-00 00:00:00</created>
      <submitted>2007-09-11 12:08:49</submitted>
      <user_name>testuser2</user_name>
      <user_url>http://www.locr.com/profile/testuser2</user_url>
    </photo>
    ...
  </photos>
</photo_list>

3. Error codes:

3.1. codes:

100: Database Error
if database is not available
101: Access Denied
the IP address was locked
200: Invalid Value
unknown value for the parameter listed in "value"
201: Missing Parameter
required parameter was not set listed in "value"
202: Missing Value
parameter was set, but value is empty, parameter listed in "value"
203: Value is not a number
parameter was set, but value is not a number, parameter listed in "value"
204: Value is out of Range
value is a number, but out of a valid range, parameter listed in "value"
205: User not found
user-id or username is not in database, parameter listed in "value"
206: Incorrect Authentification
Incorrect auth_token, api_signature, username or password, parameter listed in "value"
207: Permission Denied
you don't have the rights to view this
208: Parameter is readonly
the parameter listed in "value" is readonly
209: Wrong Format
the file you've uploaded is not jpg
210: Upload Limit exceeded
you've exceeded your upload limit
211: Photo already uploaded
the photo you've uploaded already exists
212: Photo don't exists
the photo you're trying to get ist don'nt exists
213: Album Name already exists
the album name you want to set already exists
214: No more Albums allowed
you've exceeded the allowed numbers of albums
215: Album not found
the album you want to get don't exists

3.2. Examples:

XML JSON
<?xml version="1.0"?>
<photo_list status="fail">
  <info>
    <error code="202" message="Missing Value">
      <value>search</value>
    </error>
  </info>
  <photos>
  </photos>
</photo_list>

4. Result values:

privacy:
  • 0       -> Public
  • 500   -> Friends
  • 800   -> Family
  • 1000 -> Private
* = Obligatory


Conditions
Every photo displayed on your Website have to include our name or our logo. A link to the photo page (e.g. http://www.locr.com/photo_detail.php?id=123456) at Locr.com is also a requirement. Under the photo have to be displayed the name of the author linked to his area at Locr (e.g. http://www.locr.com/profile/testuser). Also somewhere in your site you need to include the text "Photos provided by Locr are under the copyright of their owners."

Terms of use
If you have non-commercial interests, you can use the API without asking for permission. If you want to make a profit with the API, it is commercial therefore you need our explicit authorization. Please contact us under info@locr.com. Further Information under GTB.

Questions
If you have suggestions or questions, just contact us under info@locr.com