Device Image

From Tera-WURFL

Jump to: navigation, search

As of Tera-WURFL 2.1.2, you can detect and display an image of the detected mobile device.

Getting Started with Device Images

Downloading the Images

The current collection of device images is available from the WURFL Project. Once the images archive is downloaded, unzip it to a location that is available from the Internet. Normally they are located in a folder called device_pix.

Detecting the Device Image

The following code demonstrates the usage of the TeraWurflDeviceImage and displaying the image that is detected.

require_once 'TeraWurfl.php';
require_once 'TeraWurflUtils/TeraWurflDeviceImage.php';
$wurflObj = new TeraWurfl();
$image = new TeraWurflDeviceImage($wurflObj);
 * The location of the device images as they are accessed on the Internet
 * (ex. '/device_pix/', '')
 * The filename of the image will be appended to this base URL
 * The location of the device images on the local filesystem
 * Get the source URL of the image (ex. '/device_pix/blackberry8310_ver1.gif')
$image_src = $image->getImage();
	// If and image exists, show it
	$image_html = sprintf('<img src="%s" border="0"/>',$image_src);
	echo $image_html;
	// If an image is not available, show a message
	echo "No image available";
Personal tools