[opencms-dev] Get image path based on downscaled image's URL

Paul-Inge Flakstad flakstad at npolar.no
Wed Oct 31 14:15:39 CET 2012


Hi,

I'm looking into creating an adaptive image solution for my site, and I'm wondering if there's a way to retrieve the path to an original image, based on the online URL of a downscaled version.

For example: 

The online, downscaled image URL is:
http://mysite.com/opencms/export/sites/default/images/myimage.jpg_123456789.jpg

Apache will receive this, and redirect to a handler JSP, which will act as an "intelligent proxy", possibly serving a smaller image to smaller screens. In order to do this, the JSP will need to read the original image resource from the VFS. So needs to be able to somehow get the VFS path:
/images/myimage.jpg   (OR /sites/default/images/myimage.jpg)

Any way this can be done using the OpenCms API? Or do I have to resort to manually determining the VFS path based on the URL (i.e. using string methods, regexes or whatever)?

Cheers,
Paul




More information about the opencms-dev mailing list