[b]Q:[/b] How can I get the path to an output [url=http://drupal.org/project/imagecache]ImageCache[/url] preset image given the path to the original input image?
[b]A:[/b] Use the [url=http://drupal.org/project/imagecache]ImageCache[/url] function
imagecache_create_path() to get the path.
For example if your CCK node has a CCK image_field called 'field_entry_photo', then you can get the path to this image by using the following PHP code:
But, how can you get the path to the image after an imagecache preset has been applied to it? I found the answer in this [url=http://groups.drupal.org/node/20100]article[/url] - you just have to call
imagecache_create_path() passing in the desired ImageCache preset name and the path to the source image, for example:
$url = imagecache_create_path('facebook_share_thumb',
I had to use this today when connecting one of our client's sites up to Facebook using the Facebook [url=http://developers.facebook.com/docs/opengraph]Open Graph Protocol[/url] - Image urls are often needed to enable the display of content thumbnails on Facebook. Sometimes Facebook mandates maximum image sizes etc so it is handy to use ImageCache to crop and scale the images before presenting them to Facebook - and hence the need to find the ImageCache paths!