Using The Panoramio Wrapper Class

Ever been working on a project that was area specific and wanted nearby local images? I did recently, and knew after seeing images over layed onto Google maps that it must be possible. Looking around I found a few pieces of code that did what I wanted using the Panoramio API but they were all written in Javascript and I wanted to do some server side processing and caching before presenting them.

This prompted me to create a Panoramio wrapper class. Simply instantiate and provide your chosen location via its longitude and latitude and the class will return a PHP object containing images from the surrounding area. The project show up in github as being written in Javascript although this is wrong the main code is PHP, the inclusion of jQuery and a few other javascript libraries with the documentation seem to have thrown its language detection off.

Getting Started:

To get started with the Panoramio wrapper class simply clone the project from github:

git clone:

The layout of the github project is fairly straight forward with the main class being in Code/Panoramio.php. An example is also included in the code folder to give a very basic example of how to get started straight away with a minimum of options. The Docs folder contains automatically generated documentation of the class, its methods and their parameters.

Basic Usage:

Simply include the class in your code instantiate and then pass some parameters about your search:

[codesyntax lang=”php”]

$panoramioClass = new panoramioAPI();
$panoramioClass->setRequiredLocation(-37.85676, 144.98249);
$areaImages = $panoramioClass->getPanoramioImages();


The code above will return images local to St Kilda in Melbourne as I passed the coordinates for the suburb to the setRequiredLocation method. Some other useful methods are:

  • setPanoramioSize – Set the size of the images returned.
  • orderImages – Organise how images are returned, default is their upload date.
  • getPanoramioImages – Actually get a set of images from the API. Pass a number as the parameter to limit the images returned.

Project Legalities:
The Panoramio wrapper class is open source and is free to be used, modified and redistributed under a GPL v3 licence.

Special Considerations:
Panoramio requires all images are required to display Panoramio’s name and logo. Please see their site for the full list of attribution requirements when using the class to pull images from their service.

More Info:
Panoramio github project
Info on the Panaramio data API
Anthony Mills @ github

Leave a Reply

Your email address will not be published. Required fields are marked *