Home / Utilities
Utilities Home
Alembik
uaprofile2wurfl.php
Gimme UAProf and I'll give you WURFL
Alembik
Alembik Media Transcoding Server
is a Java application providing transcoding services for a variety of clients.
GAIA Reply
GAIA Image Trascoder
Open Source library that operates image transcoding,
with a special focus on mobile applications.
WURFLTera
Tera-WURFL
Use MySQL as a WURFL-powered backend!!!
WURFL Utilities
mDevInf
GUI to query *your* WURFL, by James McLachlan
Device Thumbnails
Device Thumbnails
Add device thumbnails to your appliction!
PHP Image Rendering Library (II)
Dynamically resizing pictures
in PHP (a new one)
PHP Image Rendering Library
Dynamically resizing pictures
in PHP
BeeWeeb's MWT
Mobile Web Toolkit
Open Source library that talks to the same publishing system
as your website, but generates a mobile site.
Wallify
Wallify
Turn a CHTML site into a WALL site.
Image Server
Image Server
A Java Servlet (and filter) that will intercept requests to
picture and resize the picture appropriately by looking at
the screen size. Very Cool!
|
|
Image Server
by Raul Piaggio
rpiaggio at handsoft dot com dot uy
Note from Luca
The code kindly provided by Raul relies on a slightly modified version
of the WURFL API. I would like to see this code compatible with WURFL evolution when it's
ready, but since this utility is very useful, I prefer to publish it now.
You should be able to work out the differences without problems.
You can ask questions on WMLProgramming.
|
The ImageServer is an application for transparently multiserving
images to mobile devices.
For example, let's say you have the following JPG image on the server:
If you request it from a Nokia 7700, the ImageServer will automatically resize it
to fit in the Nokia 7700 display and return it in JPG format:
If you request the same image from a Nokia 5700, the ImageServer will convert it to a
GIF instead and resize it to an even smaller size to fit in its display:
And similarly, if you request it from a Nokia 7110, it will be converted to a WBMP
(and resized):
NOTE: The aspect ratio of the image is never modified. If the aspect
ratio of the image and the device differ, the image is reduced further to fit
in the display.
Advanced functionality includes:
- Caching
- Resized/reformatted images are cached to minimize CPU work and maximize response time.
If the original image changes, the cache is updated.
- Remote retrieval
- The original images may be in another server. In this case, ImageServer will cache
the original image as well as the resized/reformatted versions. ImageServer can be
instructed to check for changes in the remote image - in which case it will update
it only if necessary - or just keep the cached one forever after retrieval -
resulting in faster service.
Requirements
ImageServer can work both as a Java Servlet or as a Java Servlet Filter. For the
Filter to work an implementation of Servlet 2.3+ (eg: Tomcat 4.1+) is needed.
ImageServer has the following dependencies, which are bundled with the current distribution:
Installation
Just deploy the contents of the directory WebContents to your web server.
If you make any modifications and wish to recompile and repackage using the provided
build.xml file make sure you update the script with the location of your server
libraries.
Usage
Original images should be stored under WEB-INF/images. Alternatively,
you can substitute images for a symbolic link to somewhere else in the file system.
Of course, there can be any directory structure underneath.
ImageServer as a Filter (Servlet Container 2.3+)
ImageServer will automatically intercept any requests for images and do the necessary
resizing/reformatting. The images directory should not be specified in the
request.
For example, let's say you have a server on localhost, port 8080, and
you deployed ImageServer to the context /ImageServer and you have the image
hello.jpg under images/greetings.
You should request it by using:
http://localhost:8080/ImageServer/greetings/hello.jpg
The response will be the image resized and reformatted to the mobile device.
ImageServer as a Servlet
In case you are using a Servlet container older than the 2.3 specification, then
Filters are not supported. But you can still use ImageServer as a Servlet.
To do this, you should invoke the servlet converter using the parameter
name to specify the image filename (without any preceding slash). The above
example would be invoked as
http://localhost:8080/ImageServer/converter?name=greetings/hello.jpg
For deployment to suceed, you should also remove any references to the
filter from web.xml.
Parameters
It is possible to pass parameters in the request URL in the usual way: http://localhost:8080/ImageServer/hello.jpg?parameter1=value1¶meter2=value2&....
- UA
- Allows you to simulate another device. The value should be what the device
sends in its User-Agent header.
Example: http://localhost:8080/ImageServer/hello.jpg?UA=Nokia7700.
- ratio
- Scales the image further by the specified ratio. Useful if we want to display
the image a bit smaller than the whole display (eg: ratio=0.8) or display two
images side by side (eg: ratio=0.5).
Example: http://localhost:8080/ImageServer/hello.jpg?ratio=0.5
Note: By default, ImageServer scales to 0.90 so that images can be displayed in a
mobile browser without the horizontal scroll bar. To override this, use ratio=1.
- width and height
- Override the device dimensions. Useful for example for using ImageServer to
generate thumbnails in a web page. If only of these is specified, the other one
is taken from the device.
Example: http://localhost:8080/ImageServer/hello.jpg?width=300&height=200
- format
- Override the device image format. Useful for debugging.
Example: http://localhost:8080/ImageServer/hello.jpg?format=wbmp
- location
- Indicates the ImageServer to retrieve the original image from another web
server if not found on the local filesystem. If the protocol is ommited,
then http will be used.
Example: ;br:
http://localhost:8080/ImageServer/hello.jpg?location=www.imageserver.com/myimages/greetings
will look for the image hello.jpg under images and if not found
will retrieve it from http://www.imageserver.com/myimages/greetings/hello.jpg
and store it locally under images for future use.
Note that the remote location can be several directories deep. In this case,
the path can be split between the actual request and the location parameter.
However, only the directory structure specified in the actual request will be
replicated when storing the image locally.
Example:
http://localhost:8080/ImageServer/greetings/hello.jpg?location=www.imageserver.com/myimages
will look for the image hello.jpg under images/greetings and
if not found will retrieve it from
http://www.imageserver.com/myimages/greetings/hello.jpg and store it locally under images/greetings for future use.
- refresh
- Used in combination with location to indicate that even if an
image is stored locally, the remote server should be checked for updates (and
retrieve the image again if there was an update). The image is requested from the
remote server with indications to send it only if it was modified since the last
retrieval. Therefore, the image is only transmitted when necessary, but the
overhead of establishing a connection with the remote server is paid every
time the image is requested. This parameter does not take a value, it acts
by just being present.
Example: http://localhost:8080/ImageServer/greetings/hello.jpg?location=www.imageserver.com/myimages&refresh
Notes
- Format priority
- ImageServer tries always tries to serve first in JPG despite the original format of the image. If this is not supported by the device, it tries GIF, PNG, BMP and finally WBMP -- in that order. No other output formats are currently supported. (Input format can be any of the supported ones by JAI Image I/O).
If the device does not support any of these formats, a 404 error (resource not found) will be returned.
- Native code JAI libraries
- There exist native code JAI libraries for a number of platforms. Using these libraries speeds up image resizing and reformatting, but -- being native libraries -- they depend on the platform and are therefore not distributed with ImageServer.
For this reason, you will get the following message in the output when ImageServer attempts its first operation:
Error: Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.
Occurs in: com.sun.media.jai.mlib.MediaLibAccessor
com.sun.media.jai.mlib.MediaLibLoadException
But the ImageServer will work just fine nonetheless.
To download the native libraries for your platform, plase visit the JAI page. You should download the JAI package for your platform and then copy the native libraries (.dll files for Windows or .so files for Linux, for example) in a directory where the system can find them. A good place is the lib/i386 directory under the JRE. The web server has to be restarted for this change to take effect.
Licensing
The ImageServer is distributed under the MPL license.
Download
ImageServer can be downloaded here.
Just unpack in your Tomcat webapps directory.
The ImageServer should work on Tomcat 4.1+ (as long as JRE 5+ is used).
The application should run out of the box.
In addition to the application, there is also a 'src' directory with the source code and an ant build file to rebuild imageServer.jar and place it in WEB-INF/lib.
|