Q: How can I get the path to an output ImageCache preset image given the path to the original input image?
A: Use the ImageCache 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:
$node->field_entry_photo[0]['filepath']
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 article - 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',
$node->field_entry_photo[0]['filepath']);
I had to use this today when connecting one of our client's sites up to Facebook using the Facebook Open Graph Protocol - 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!
i was looking for... thanks!
Drupal forever!
PD: 4 times I had to validate the captcha (too small images, xD)
Greetings