×
Namespaces

Variants
Actions

Archived:Image service in WidSets

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Article
Created: User:Mirsilla (04 Jun 2008)
Last edited: hamishwillee (29 Jun 2012)
FNWID.gif

Contents

The service

The image service delivers all images to the client scripts (widgets) in a format that is supported in the mobile terminal.

In the usual case, images are converted to 8 bit indexed color PNG format with the colors reduced. You can also request 24 bit PNG or JPEG images. However, note that only 8 bit PNGs are guaranteed to work on all MIDP 2.0 mobile Java implementations.

Note. The old picviewer service has been removed and its functionality has been separated into Image service and Archived:Syndication service in WidSets. Now the sole purpose of Image service is to fetch images on demand. Syndication service takes care of delivering feed content such as Flickr image feeds.

The service consists of four actions of which only the first is necessary in normal development:

Action Generic Function
geturl yes Receive an image scaled to the size specified in the call. The caller can set a bounding box into which the image is fitted. Other optional arguments are also possible.
getres yes Gets a widget image resource with the id.
getwidgeticon yes Gets a widget icon using the widget id.
getavatar yes Gets an user avatar using the user name.


Scaling

Images are scaled using a bounding box. The image is resized so that it fits completely into the dimensions of the box. The original aspect ratio of the image is conserved. Maximum dimensions for the box are 1920x1920 pixels. Also, source images larger than this are scaled down to fit into the maximum box if neither bounding box arguments are given.

Service actions

The following sections describe the specifications for the available service actions.

Action geturl

namespace geturl is ContentAction
{
  input = (list (bag (bind (const url) (string url))
                     (optional (bind (const boundx) (int boundx)))
                     (optional (bind (const boundy) (int boundy)))
                     (optional (bind (const minsize) (int bytesize)))
                     (optional (bind (const minwidth) (int minwidth)))
                     (optional (bind (const minheight) (int minheight)))
                     (optional (bind (const refreshtime) (int seconds)))
                     (optional (bind (const format) 
                                     (choice (const png8)
                                             (const png24)
                                             (const jpeg))))))
    
    
  output = (bytes imageData)
    
  generic = true
}
Arguments

The only required argument is url. The rest are optional.

name type Description
url string The URL of the image.
boundx int The width of the bounding box.
boundy int The height of the bounding box.
minsize int The minimum size of the image in bytes of the source image.
minwidth int The minimum width of the image in pixels of the source image.
minheight int The minimum height of the image in pixels of the source image.
refreshtime int Caching time of the image in seconds. If this argument is not given the default will be 10800s. The minimum is 60s.
format png8 | png24 | jpeg The desired encode format. Please use png-images for maximum compatibility.
Errors
Code Message Description
error Unable to get image: <message> Something went wrong. For example, the server returned 404 for the requested URL.


Action getres

namespace getres is ContentAction
{
  input = (list (bag (bind (const id) (int resourceId))
                     (optional (bind (const boundx) (int boundx)))
                     (optional (bind (const boundy) (int boundy)))
                     (optional (bind (const format) 
                                     (choice (const png8)
                                             (const png24)
                                             (const jpeg))))))
  

  output = (bytes resourceData)  
  
  generic = true
}
Errors
Code Message Description
notfound Image not found or access denied. No such resource id, or user trying to get resource of a PRIVATE widget belonging to another user.
notimage The requested resource was not an image. The requested resource was of some other type.
error Unable to get image: <message> Something went wrong. For example, a temporary error.


Action getwidgeticon

namespace getwidgeticon is ContentAction
{
  input = (int widgetId)
    
  output = (bytes iconResourceData)

  generic = true
}
Errors
Code Message Description
notfound Image not found or access denied. No such icon
error Unable to get image: <message> Something went wrong, for example, a temporary error.


Action getavatar

namespace getavatar is ContentAction
{
  input = (list (bag (bind (const username) (string username))
                     (optional (bind (const boundx) (int boundx)))
                     (optional (bind (const boundy) (int boundy)))
                     (optional (bind (const format) 
                                     (choice (const png8)
                                             (const png24)
                                             (const jpeg))))))
                                              
  output = (bytes avatarImageData)

  generic = true
    
}
Errors
Code Message Description
notfound Image not found or access denied. No such avatar.
error Unable to get image: <message>. Something went wrong. For example, a temporary error.

Code example

Archived:Example Image Service in WidSets

See also

This page was last modified on 29 June 2012, at 09:36.
25 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×